/** Tests that HTML with no tables is ignored. */ @Test public final void testNoTables_Ignored() { final String html; // HTML code to fix final String htmlExpected; // Expected result final String result; // Actual result html = "<p>Some text</p>"; result = util.updateTables(html); htmlExpected = "<p>Some text</p>"; Assert.assertEquals(result, htmlExpected); }
/** Tests that outdated tables are correctly cleaned up. */ @Test public final void testOutdatedTable_Updated() { final String html; // HTML code to fix final String htmlExpected; // Expected result final String result; // Actual result html = "<table border=\"0\" class=\"bodyTable\"><tbody><tr class=\"a\"><th>Header 1</th><th>Header 2</th></tr><tr class=\"b\"><td>Data 1</td><td>Data 2</td></tr></tbody></table>"; result = util.updateTables(html); htmlExpected = "<table>\n <thead>\n <tr>\n <th>Header 1</th>\n <th>Header 2</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Data 1</td>\n <td>Data 2</td>\n </tr>\n </tbody>\n</table>"; Assert.assertEquals(result, htmlExpected); }