### Question:
Node implements Cloneable { public String absUrl(String attributeKey) { Validate.notEmpty(attributeKey); if (!hasAttr(attributeKey)) { return ""; } else { return StringUtil.resolve(baseUri(), attr(attributeKey)); } } protected  Node(); abstract String nodeName(); boolean hasParent(); String attr(String attributeKey); abstract Attributes attributes(); Node attr(String attributeKey, String attributeValue); boolean hasAttr(String attributeKey); Node removeAttr(String attributeKey); Node clearAttributes(); abstract String baseUri(); void setBaseUri(final String baseUri); String absUrl(String attributeKey); Node childNode(int index); List<Node> childNodes(); List<Node> childNodesCopy(); abstract int childNodeSize(); Node parent(); final Node parentNode(); Node root(); Document ownerDocument(); void remove(); Node before(String html); Node before(Node node); Node after(String html); Node after(Node node); Node wrap(String html); Node unwrap(); void replaceWith(Node in); List<Node> siblingNodes(); Node nextSibling(); Node previousSibling(); int siblingIndex(); Node traverse(NodeVisitor nodeVisitor); String outerHtml(); T html(T appendable); String toString(); @Override boolean equals(Object o); boolean hasSameValue(Object o); @Override Node clone();  }### Answer:
@Test public void handlesBaseUri() { Tag tag = Tag.valueOf("a"); Attributes attribs = new Attributes(); attribs.put("relHref", "/foo"); attribs.put("absHref", "http: Element noBase = new Element(tag, "", attribs); assertEquals("", noBase.absUrl("relHref")); assertEquals("http: Element withBase = new Element(tag, "http: assertEquals("http: assertEquals("http: assertEquals("", withBase.absUrl("noval")); Element dodgyBase = new Element(tag, "wtf: assertEquals("http: assertEquals("", dodgyBase.absUrl("relHref")); }
@Test public void handleAbsOnFileUris() { Document doc = Jsoup.parse("<a href='password'>One/a><a href='/var/log/messages'>Two</a>", "file:/etc/"); Element one = doc.select("a").first(); assertEquals("file:/etc/password", one.absUrl("href")); Element two = doc.select("a").get(1); assertEquals("file:/var/log/messages", two.absUrl("href")); }
@Test public void handleAbsOnLocalhostFileUris() { Document doc = Jsoup.parse("<a href='password'>One/a><a href='/var/log/messages'>Two</a>", "file: Element one = doc.select("a").first(); assertEquals("file: }
@Test public void absHandlesRelativeQuery() { Document doc = Jsoup.parse("<a href='?foo'>One</a> <a href='bar.html?foo'>Two</a>", "https: Element a1 = doc.select("a").first(); assertEquals("https: Element a2 = doc.select("a").get(1); assertEquals("https: }
@Test public void absHandlesDotFromIndex() { Document doc = Jsoup.parse("<a href='./one/two.html'>One</a>", "http: Element a1 = doc.select("a").first(); assertEquals("http: }