UrlImpl implements Path { public boolean isPrefixOf(Path url) { if (url == null) throw new IllegalArgumentException("Cannot be prepended by null!"); return url.getPath().indexOf(path) == 0; } 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 testIsPrefixOf() { Path u1 = new UrlImpl(defaultUrl, "/abc"); Path u2 = new UrlImpl("/abc"); assertTrue(defaultUrl.isPrefixOf(u1)); assertTrue(defaultUrl.isPrefixOf(defaultUrl)); assertFalse(defaultUrl.isPrefixOf(u2)); }