UrlFilterSameHost extends AbstractExtensionPoint implements URLFilter { @Override public boolean filter(String child, String parent) { try { return new URL(child).getHost().equals(new URL(parent).getHost()); } catch (MalformedURLException e) { throw new RuntimeException(e); } }  @Override boolean filter(String child, String parent);  }
@Test public void filter() throws Exception { UrlFilterSameHost plugin = TestUtils.newInstance(UrlFilterSameHost.class, "urlfilter-samehost"); String urls[] = { "http: "http: "http: }; assertTrue(plugin.filter(urls[0], urls[1])); assertFalse(plugin.filter(urls[0], urls[2])); }