DomainBasedUriGenerator implements UriGenerator { @Override public CrawleableUri getUriVariant(CrawleableUri uri) { URI newUri = null; URI uriObject = uri.getUri(); String domain = uriObject.getHost(); CrawleableUri uriVariant = null; try { newUri = new URI(domain); uriVariant = new CrawleableUri(newUri); } catch (URISyntaxException e) { LOGGER.error("Exception while generating variant URIs", e); } return uriVariant; }  @Override CrawleableUri getUriVariant(CrawleableUri uri);  }
@Test public void getUriVariant(){ CrawleableUri originalUri = null; try { originalUri = new CrawleableUri( new URI("http: } catch (URISyntaxException e) { e.printStackTrace(); } CrawleableUri actualUriVariant = variantUriObject.getUriVariant(originalUri); boolean domainFlag = false; try { CrawleableUri domainUri = new CrawleableUri( new URI("www.example.com")); if(actualUriVariant.equals(domainUri)) domainFlag = true; } catch (URISyntaxException e) { e.printStackTrace(); } Assert.assertTrue(domainFlag); }