### Question:
URIResolver { static URIResolver newInstance(URI endpoint, URI alternative) { checkNotNull(endpoint,"Endpoint URI cannot be null"); checkNotNull(alternative,"Alternative URI cannot be null"); checkArgument(alternative.isAbsolute() && !alternative.isOpaque(),"Alternative URI must be absolute hierarchical"); checkArgument(endpoint.isAbsolute() && !endpoint.isOpaque(),"Endpoint URI must be absolute hierarchical"); checkArgument(!endpoint.equals(alternative),"Endpoint URI must be different from the alternative one"); return new URIResolver(endpoint,alternative); } private  URIResolver(URI endpoint, URI alternative); @Override String toString();  }### Answer:
@Test(expected=NullPointerException.class) public void testNewInstance$nullEndpoint() throws Exception { URIResolver.newInstance(null, alternative); }
@Test(expected=NullPointerException.class) public void testNewInstance$nullAlternative() throws Exception { URIResolver.newInstance(endpoint, null); }
@Test(expected=IllegalArgumentException.class) public void testNewInstance$sameEndpointAsAlternative() throws Exception { URIResolver.newInstance(endpoint, endpoint); }
@Test(expected=IllegalArgumentException.class) public void testNewInstance$opaqueEndpoint() throws Exception { URIResolver.newInstance(URI.create("urn:opaque"), alternative); }
@Test(expected=IllegalArgumentException.class) public void testNewInstance$opaqueAlternative() throws Exception { URIResolver.newInstance(endpoint,URI.create("urn:opaque")); }
@Test(expected=IllegalArgumentException.class) public void testNewInstance$relativeEndpoint() throws Exception { URIResolver.newInstance(URI.create("relative/path"), alternative); }
@Test(expected=IllegalArgumentException.class) public void testNewInstance$relativeAlternative() throws Exception { URIResolver.newInstance(endpoint,URI.create("relativePath")); }