### Question:
HtmlParser { public void parse(InputSource input, DocumentBuilder builder) throws IOException, SAXException { parse(input, builder, true); } private  HtmlParser(AbstractSaxHtmlParser parser);  HtmlParser(); static HtmlParser instanceWithHtmlCleanupRules(); static HtmlParser instance(); void parse(InputSource input, DocumentBuilder builder); void parse(InputSource input, DocumentBuilder builder, boolean asDocument);  }### Answer:
@Test public void parsePreservesAsDocumentSetting() throws IOException, SAXException { HtmlParser parser = new HtmlParser(); StringWriter out = new StringWriter(); HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out); builder.setEmitAsDocument(false); parser.parse(new InputSource(new StringReader("before <em>emphasis</em> after")), builder); assertEquals("before <em>emphasis</em> after", out.toString()); }