assertStringEquals("body contents", "Welcome to HTMLParser", page.getBody().asString());
}
public void testCreatePageWithTables() throws Exception {
createParser(PAGE_WITH_TABLE);
HtmlPage page = new HtmlPage(parser);
parser.visitAllNodesWith(page);
NodeList bodyNodes = page.getBody();
assertEquals("number of nodes in body", 2, bodyNodes.size());
assertXmlEquals("body html", "Welcome to HTMLParser" + "<table>" + "<tr>" + " <td>cell 1</td>"
+ " <td>cell 2</td>" + "</tr>" + "</table>", bodyNodes.asHtml());
TableTag tables[] = page.getTables();
assertEquals("number of tables", 1, tables.length);
assertEquals("number of rows", 1, tables[0].getRowCount());
TableRow row = tables[0].getRow(0);
assertEquals("number of columns", 2, row.getColumnCount());
TableColumn[] col = row.getColumns();