StorageAccess { public String safeFilename(String filename) { filename = filename.replaceAll("[*?/<>&!#$+\"'{}:@\\\\]",""); filename = filename.replaceAll("\\s{2,}", " "); return filename.trim(); }  String safeFilename(String filename);  }
@Test public void safeFilename() { String input = "This is a <*bad*> /Filename\\ & who knows what it wull do!! # $ + \" ' { } : @ "; String output; String expected = "This is a bad Filename who knows what it wull do"; StorageAccess storageAccess = new StorageAccess(); output = storageAccess.safeFilename(input); assertEquals(expected,output); }