### Question:
FilePersistenceUtils { static String sanitizeFileName(String name) { if(name == null || name.isEmpty()) { return ""; } StringBuilder cleanName = new StringBuilder(); int len = name.codePointCount(0, name.length()); for (int i = 0; i < len; i++) { int c = name.codePointAt(i); if (Arrays.binarySearch(ILLEGAL_CHARS, c) < 0) { cleanName.appendCodePoint(c); } } try { return new File(cleanName.toString()).getCanonicalFile().getName(); } catch (IOException ex) { return ""; } }    }### Answer:
@Test public void testSanitizeFileName() { String name = "name.é"; Assert.assertEquals("name.é", FilePersistenceUtils.sanitizeFileName(name)); name = "/name.é"; Assert.assertEquals("name.é",FilePersistenceUtils.sanitizeFileName(name)); name = "name.é\\"; Assert.assertEquals("name.é",FilePersistenceUtils.sanitizeFileName(name)); name = "\\name.txt"; Assert.assertEquals("name.txt", FilePersistenceUtils.sanitizeFileName(name)); name = "../name.txt"; Assert.assertEquals("..name.txt",FilePersistenceUtils.sanitizeFileName(name)); name = "~/name.txt"; Assert.assertEquals("~name.txt",FilePersistenceUtils.sanitizeFileName(name)); name = "name.txt\r\n"; Assert.assertEquals("name.txt",FilePersistenceUtils.sanitizeFileName(name)); }