### Question:
HtmlSystem extends SimpleSystemImpl { public static HtmlSystem forUrl(String url) throws Exception { HtmlSystem hs = new HtmlSystem(); hs.connect(); HtmlNode htmlNode = (HtmlNode) hs.moveTo(url); htmlNode.recursiveOut("child", Integer.MAX_VALUE); return hs; }  HtmlCleaner getCleaner(); @Override SimpleSystem connect(String... connectionParams); @Override SimpleNode moveTo(String nodeQuery, String... keys); @Override Class<? extends SimpleNode> getNodeClass(); static HtmlSystem forUrl(String url);  }### Answer:
@Test public void testRootNodeAttributes() throws Exception { HtmlSystem hs = HtmlSystem.forUrl("http: HtmlNode htmlNode = (HtmlNode) hs.getStartNode(); assertEquals("html", htmlNode.getRootNode().getName()); if (debug) { htmlNode.forAll(SimpleNode.printDebug); } GraphTraversal<Vertex, Vertex> links = hs.g().V().hasLabel("a"); assertEquals(72, links.count().next().longValue()); links = hs.g().V().hasLabel("a"); if (debug) links.forEachRemaining( link -> System.out.println(link.property("href").value())); }
@Test public void testPDFLinks() throws Exception { HtmlSystem hs = HtmlSystem.forUrl( "http: HtmlNode htmlNode = (HtmlNode) hs.getStartNode(); assertEquals("html", htmlNode.getRootNode().getName()); if (debug) { htmlNode.forAll(SimpleNode.printDebug); } GraphTraversal<Vertex, Vertex> links = hs.g().V().hasLabel("a").has("href", RegexPredicate.regex(".*pdf")); assertEquals(4, links.count().next().longValue()); links = hs.g().V().hasLabel("a").has("href", RegexPredicate.regex(".*pdf")); links.forEachRemaining( link -> System.out.println(link.property("href").value())); }