@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)); }); }
public static boolean containsInvalidCharacter(String name) { Set<Character> charBlacklist = getCharBlacklist(); for (char c : name.toCharArray()) { if (charBlacklist.contains(c)) { return true; } } return false; }
CharacterBlacklistUtil { public static boolean containsInvalidCharacter(String name) { Set<Character> charBlacklist = getCharBlacklist(); for (char c : name.toCharArray()) { if (charBlacklist.contains(c)) { return true; } } return false; } }
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(); }
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); }
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);  }