CharacterBlacklistUtil { public static boolean containsInvalidCharacter(String name) { Set<Character> charBlacklist = getCharBlacklist(); for (char c : name.toCharArray()) { if (charBlacklist.contains(c)) { return true; } } return false; } private  CharacterBlacklistUtil(); static String filterAndReplace(String string); static boolean containsInvalidCharacter(String name); static String encodeName(String name); static String encodePath(String path); static String decodePath(String path); static String decodeName(String name);  }
@Test void containsInvalidCharacter() { Character[] blacklistChar = {CharacterBlacklist.LESS_THAN, CharacterBlacklist.GREATER_THAN, CharacterBlacklist.COLON, CharacterBlacklist.DOUBLE_QUOTE, CharacterBlacklist.FORWARD_SLASH, CharacterBlacklist.BACK_SLASH, CharacterBlacklist.PIPE, CharacterBlacklist.QUESTION_MARK, CharacterBlacklist.ASTERISK, CharacterBlacklist.NULL_CHAR}; Stream.of(blacklistChar).forEach(c -> { assertTrue(CharacterBlacklistUtil.containsInvalidCharacter("example with invalid character " + c)); }); }
@Test void containsNoInvalidCharacter() { assertFalse(CharacterBlacklistUtil.containsInvalidCharacter("example with no invalid characters")); }