NameUtils { public static void checkFilename(String filename) throws AccessException, NameTooLongException { if (filename.length() > 256) { throw new NameTooLongException(); } if (filename.length() == 0 || filename.indexOf('/') != -1 || filename.indexOf('\0') != -1 ) { throw new AccessException(); } } private  NameUtils(); static void checkFilename(String filename);  }
@Test public void testWithGoodName() throws AccessException, NameTooLongException { checkFilename(GOOD_NAME); }
@Test public void testWithGoodArmName() throws AccessException, NameTooLongException { checkFilename(GOOD_UTF8_ARM); }
@Test public void testWithGoodHbrName() throws AccessException, NameTooLongException { checkFilename(GOOD_UTF8_HBR); }
@Test(expected = AccessException.class) public void testEmptyName() throws AccessException, NameTooLongException { checkFilename(EMPTY_NAME); }
@Test(expected = AccessException.class) public void testNameWithSlash() throws AccessException, NameTooLongException { checkFilename(WITH_SLASH); }
@Test(expected = AccessException.class) public void testNameWithNull() throws AccessException, NameTooLongException { checkFilename(WITH_NULL); }