### Question:
URIDescriber { URIDescriptor describe(URI candidate) { Scope scope=null; Type type=null; if(candidate.isOpaque()) { scope=Scope.EXTERNAL; type=Type.OPAQUE; } else if(candidate.isAbsolute()) { type=Type.ABSOLUTE; URI relative = this.endpoint.relativize(candidate); if(relative.isAbsolute()) { relative=this.application.relativize(candidate); if(relative.isAbsolute()) { scope=Scope.EXTERNAL; } else { scope=Scope.APPLICATION; } } else { if(relative.getPath().split("/").length==1) { scope=Scope.ENDPOINT; } else { scope=Scope.RESOURCE; } } } else { scope=Scope.RESOURCE; if(candidate.equals(SELF_URI)) { type=Type.SELF; } else if(candidate.normalize().getPath().startsWith(ANCESTOR_SEGMENT)) { type=Type.ANCESTOR; } else { type=Type.CHILD; } } return URIDescriptor.newDescriptor(scope, type); } private  URIDescriber(URI application, URI endpoint); @Override String toString();  }### Answer:
@Test public void testDescribe() { for(Entry<String, URIDescriptor> entry:candidateMap.entrySet()) { URI candidate = URI.create(entry.getKey()); URIDescriptor result = sut.describe(candidate); System.out.printf("%s.describe(%s): %s%n",sut,candidate,result); assertThat("Evaluation failed ["+candidate+"]",result,equalTo(entry.getValue())); } }