PathUtil { public static String fix(String path) { if (path == null) { return null; } path = path.trim(); path = path.replaceAll("[/\\s]+", "/"); return path; }  static String parentPath(String path); static String fix(String path); static String getExtention(String path); static String concatPath(String path, String child); static String removeExtention(String path); static String getName(String path); static String toUrl(URL resource); static String toUrl(String url); static List<String> split(String path);  }
@Test public void testFix() { assertNull(PathUtil.fix(null)); assertEquals("xyz.txt", PathUtil.fix("xyz.txt")); assertEquals("/xyz.txt/", PathUtil.fix(" assertEquals("/abc/fff/xyz.txt", PathUtil.fix(" assertEquals("/abc/fff/xyz.txt/", PathUtil.fix(" assertEquals("/abc/fff/xyz.txt/", PathUtil.fix(" assertEquals("/abc/fff/xyz.txt/", PathUtil.fix(" assertEquals("/", PathUtil.fix("/")); }