SimpleUrlToAppDomainConverter implements Function<URI, String> { @Override public String apply(URI uri) { return Assert.requireNonNull(uri, "uri").getHost() + ":" + uri.getPort(); }  @Override String apply(URI uri);  }
@Test public void getApplicationDomain_whenGivenAURL_thenConvertAppDomainCorrectly() throws Exception { URL url = new URL(PROTOCOL, HOST, PORT, ""); String result = simpleUrlToAppDomainConverter.apply(url.toURI()); Assert.assertEquals(result, HOST + ":" + PORT); }
@Test(expectedExceptions = NullPointerException.class) public void getApplicationDomain_whenGivenANullURL_thenThrownANullPointerException() throws Exception { simpleUrlToAppDomainConverter.apply(null); }