PathUtils { public static String normalize(String path) { try { String result = new URI(path).normalize().toString(); if (result.startsWith(" result = result.substring(1); } return result; } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal path", e); } }  static String join(String... paths); static String normalize(String path); static boolean isAbsolute(String path); static String removeLeadingSlash(String path); static String addLeadingSlash(String path); static String addTrailingSlash(String path);  }
@Test public void normalizeNormalizedPaths() { assertEquals("abc", normalize("abc")); assertEquals("/abc/abc", normalize("/abc/abc")); }
@Test public void testNormalize() { assertEquals("/abc", normalize(" assertEquals("/abc/abc/", normalize(" assertEquals("/abc/", normalize("/abc/")); }
@Test public void relativeInOutNormalize() { assertEquals("abc", normalize("./abc")); assertEquals("../abc", normalize("../abc")); assertEquals("../../abc", normalize("../../abc")); assertEquals("bb", normalize("./abc/../bb")); assertEquals("", normalize("./abc/../")); }