NameFilter { public static String convertName(byte[] bytes) throws ChimeraNFSException { String name = convertPath(bytes); if (name.length() > NFSv4Defaults.NFS4_MAXFILENAME) { throw new NameTooLongException("name too long"); } if (name.equals(".") || name.equals("..")) { throw new BadNameException("bad name '.' or '..'"); } if (name.indexOf('/') != -1) { throw new BadNameException("name with slash '/'"); } return name; } private  NameFilter(); static String convertName(byte[] bytes); static String convertPath(byte[] bytes);  }
@Test public void testGoodUtf8() throws ChimeraNFSException { NameFilter.convertName(GOOD_UTF8); }
@Test public void testGoodUtf8Arm() throws ChimeraNFSException { NameFilter.convertName(GOOD_UTF8_ARM); }
@Test public void testGoodUtf8Hbr() throws ChimeraNFSException { NameFilter.convertName(GOOD_UTF8_HBR); }
@Test(expected = InvalException.class) public void testBadUtf8() throws ChimeraNFSException { NameFilter.convertName(BAD_UTF8); }
@Test(expected = NameTooLongException.class) public void testNameTooLong() throws ChimeraNFSException { NameFilter.convertName(NAME_TOO_LONG); }
@Test(expected = InvalException.class) public void testEmptyName() throws ChimeraNFSException { NameFilter.convertName(EMPTY_NAME); }
@Test(expected = BadNameException.class) public void testDot() throws ChimeraNFSException { NameFilter.convertName(DOT); }
@Test(expected = BadNameException.class) public void testDotDot() throws ChimeraNFSException { NameFilter.convertName(DOT_DOT); }
@Test(expected = BadNameException.class) public void testNameWithSlash() throws ChimeraNFSException { NameFilter.convertName(WITH_SLASH); }
@Test(expected = BadNameException.class) public void testNameWithNull() throws ChimeraNFSException { NameFilter.convertName(WITH_NULL); }
@Test(expected = InvalException.class) public void testUtf8WithSurrogat() throws ChimeraNFSException { NameFilter.convertName(UTF8_WITH_SURROGAT); }