UrlImpl implements Path { protected String trim(String url) { if (url == null) return null; url = url.trim().toLowerCase(); url = url.replace(doublePathElementSeparator, pathElementSeparator); if (url.endsWith(pathElementSeparator) || url.equals(pathElementSeparator)) return url; int index = url.lastIndexOf(pathElementSeparator); int dotIndex = url.indexOf(".", index); int anchorIndex = url.indexOf("#", index); if (dotIndex == -1 && anchorIndex == -1) url += pathElementSeparator; return url; } UrlImpl(String path);  UrlImpl(Path url, String path);  UrlImpl(String path, char separator); protected  UrlImpl(char separator); char getPathSeparator(); void setPath(String path); String getPath(); boolean startsWith(String path); boolean endsWith(String path); boolean isPrefixOf(Path url); boolean isExtensionOf(Path url); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testTrim() { assertEquals("/test/", new UrlImpl("/test").getPath()); assertEquals("/test/", new UrlImpl("/test/").getPath()); }