### Question:
SmartFile { public static File sanitize(File f) { SmartFile sf = new SmartFile(f); return new File(sf.path); } private  SmartFile(File f); private  SmartFile(String s); static File sanitize(File f); static String sanitize(String filename); static String sanitizePaths(String pathsString);  }### Answer:
@Test public void edgeCase() { if(OS.isWindows()) return; String fn = "/../../../../../../../../foo"; assertEquals(SmartFile.sanitize(fn), "/foo"); fn = "/../foo"; assertEquals(SmartFile.sanitize(fn), "/foo"); fn = "/foo/../foo"; assertEquals(SmartFile.sanitize(fn), "/foo"); fn = "/foo/../../foo"; assertEquals(SmartFile.sanitize(fn), "/foo"); }
@Test public void edgeCase() { if(OS.isWindows()) return; String fn = "/../../../../../../../../foo"; assertEquals("/foo", SmartFile.sanitize(fn)); fn = "/../foo"; assertEquals("/foo", SmartFile.sanitize(fn)); fn = "/foo/../foo"; assertEquals("/foo", SmartFile.sanitize(fn)); fn = "/foo/../../foo"; assertEquals("/foo", SmartFile.sanitize(fn)); }