Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
nfs4j
Commits
a2335790
Commit
a2335790
authored
Dec 22, 2011
by
Tigran Mkrtchyan
☕
Browse files
junit: add name filter test
parent
20b7f4e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/org/dcache/chimera/nfs/v4/NameFilterTest.java
0 → 100644
View file @
a2335790
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package
org.dcache.chimera.nfs.v4
;
import
org.dcache.chimera.nfs.ChimeraNFSException
;
import
org.junit.Test
;
public
class
NameFilterTest
{
private
static
final
byte
[]
BAD_UTF8
=
new
byte
[]{
(
byte
)
0xfc
,
(
byte
)
0x80
,
(
byte
)
0x80
,
(
byte
)
0x80
,
(
byte
)
0x80
,
(
byte
)
0xaf
};
private
static
final
byte
[]
GOOD_UTF8
=
"a normal string"
.
getBytes
();
private
static
final
byte
[]
EMPTY_NAME
=
new
byte
[
0
];
private
static
final
byte
[]
NAME_TOO_LONG
=
new
byte
[
NFSv4Defaults
.
NFS4_MAXFILENAME
+
1
];
@Test
public
void
testGoodUtf8
()
throws
ChimeraNFSException
{
NameFilter
.
convert
(
GOOD_UTF8
);
}
@Test
(
expected
=
ChimeraNFSException
.
class
)
public
void
testBadUtf8
()
throws
ChimeraNFSException
{
NameFilter
.
convert
(
BAD_UTF8
);
}
@Test
(
expected
=
ChimeraNFSException
.
class
)
public
void
testNameTooLong
()
throws
ChimeraNFSException
{
NameFilter
.
convert
(
NAME_TOO_LONG
);
}
@Test
(
expected
=
ChimeraNFSException
.
class
)
public
void
testEmptyName
()
throws
ChimeraNFSException
{
NameFilter
.
convert
(
EMPTY_NAME
);
}
//
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment