MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / asXml

Method asXml

src/test/java/org/htmlunit/WebClient8Test.java:54–73  ·  view source on GitHub ↗

@throws Exception if something goes wrong

()

Source from the content-addressed store, hash-verified

52 * @throws Exception if something goes wrong
53 */
54 @Test
55 public void asXml() throws Exception {
56 final String html = DOCTYPE_HTML
57 + "<html><head><title>foo</title></head>\n"
58 + "<body><div>Hello <b>HtmlUnit</b></div></body></html>";
59
60 try (WebClient webClient = new WebClient(getBrowserVersion(), false, null, -1)) {
61 final HtmlPage page = loadPage(webClient, html, null, URL_FIRST);
62 assertEquals("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<html>\r\n"
63 + " <head>\r\n"
64 + " <title>foo</title>\r\n"
65 + " </head>\r\n"
66 + " <body>\r\n"
67 + " <div>Hello <b>HtmlUnit</b>\r\n"
68 + " </div>\r\n"
69 + " </body>\r\n"
70 + "</html>",
71 page.asXml());
72 }
73 }
74
75 /**
76 * @throws Exception if something goes wrong

Callers 1

cloneNodeMethod · 0.45

Calls 3

getBrowserVersionMethod · 0.45
loadPageMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected