Util { public static String escapeFileName(String fileName) { return fileName.replaceAll("[^a-zA-Z0-9.-]", "_"); } private  Util(); static U getOrCreate(Map<T, U> map, T key, Supplier<U> f); static Map<String, String> toMap(Properties properties); static String escapeFileName(String fileName);  }
@Test public void testEscapeFileName() { assertThat(Util.escapeFileName("myfile.html")).isEqualTo("myfile.html"); assertThat(Util.escapeFileName("myfile.h.html")).isEqualTo("myfile.h.html"); assertThat(Util.escapeFileName("invalid:name.html")).isEqualTo("invalid_name.html"); assertThat(Util.escapeFileName("name-ok.html")).isEqualTo("name-ok.html"); }