CharacterBlacklistUtil { public static String filterAndReplace(String string) { Set<Character> charBlacklist = getCharBlacklist(); for (char c : string.toCharArray()) { if (charBlacklist.contains(c)) { string = string.replace(c, REPLACEMENT_CHAR); } } return compressString(string, REPLACEMENT_CHAR); } 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 filterAndReplace() { assertEquals("example-slashed.xml", CharacterBlacklistUtil.filterAndReplace("example-/-\\-slashed.xml")); }
@Test void stringCompressionOnRepeatingHyphens() { assertEquals("example-", CharacterBlacklistUtil.filterAndReplace("example-------")); }