### Question:
URIResolver { URI resolve(URI c1, URI c2) { URI cr1 = this.endpoint.relativize(c1); URI cr2 = this.endpoint.relativize(c2); URI resolved=null; if(cr1.equals(cr2)) { resolved=c1; } else if(cr1.equals(SELF_URI) && cr2.equals(this.alternative)) { resolved=cr1; } else if(cr1.isAbsolute() && !cr2.isAbsolute()){ resolved=c2; } else if(!cr1.isAbsolute() && cr2.isAbsolute()){ resolved=cr1; } else if(cr1.isAbsolute() && cr2.isAbsolute()){ resolved = getRelativePathFromBase(cr1); } return resolved; } private  URIResolver(URI endpoint, URI alternative); @Override String toString();  }### Answer:
@Test public void testResolve() { for(int i=0;i<candidates.length;i++) { String candidate = candidates[i]; URI erCandidate = endpoint.resolve(candidate); URI arCandidate = alternative.resolve(candidate); URI rCandidate = sut.resolve(erCandidate, arCandidate); System.out.printf("<%s> %s.resolve(<%s>,<%s>): <%s>%n",candidate,sut,erCandidate,arCandidate,rCandidate); assertThat("Resolution failed ["+i+"]",rCandidate.toString(),equalTo(candidate)); } }