### Question:
AbsolutePathReferenceVisitor implements Visitor { @VisibleForTesting Uri getBaseUri(Document doc) { String baseHref = getBaseHref(doc); if (baseHref != null) { try { return Uri.parse(baseHref); } catch (Uri.UriException e) { } } return null; } @Inject  AbsolutePathReferenceVisitor(Tags... resourceTags); VisitStatus visit(Gadget gadget, Node node); boolean revisit(Gadget gadget, List<Node> node); static Attr getUriAttributeFromNode(Node node, Map<String, String> resourceTags);  }### Answer:
@Test public void testGetBaseUri() throws Exception { Element baseTag1 = elem("base", "href", "http: Element baseTag2 = elem("base", "href", "http: Element img = elem("img", "src", RELATIVE_URI.toString()); Element a = elem("a", "href", RELATIVE_URI.toString()); Node[] headNodes = { baseTag1 }; Element html = htmlDoc(headNodes, baseTag2, img, a); AbsolutePathReferenceVisitor visitor = visitorForAllTags(); assertEquals("http: visitor.getBaseHref(html.getOwnerDocument())); assertEquals("http: visitor.getBaseUri(html.getOwnerDocument()).toString()); }