1 package net.sourceforge.jwebunit; 2 3 6 public class ExpectedTableAssertionsTest extends JWebUnitTest { 7 8 public void setUp() throws Exception { 9 super.setUp(); 10 addTestPage(); 11 beginAt("/testPage.html"); 12 } 13 14 public void testAssertTableEquals() throws Throwable { 15 ExpectedTable goodTable = new ExpectedTable(new Object [][] { 16 {"table text", ""}, 17 {"table text row 2", ""}, 18 {"table text row 3", "row 3 col 1"}, 19 {new ExpectedCell("row 4", 2)}, 20 }); 21 assertPass("assertTableEquals", new Object []{"testTable", goodTable}); 22 } 23 24 public void testAssertTableEqualsMissingRows() throws Throwable { 25 ExpectedTable badTable = new ExpectedTable(new Object [][] { 26 {"table text", ""}, 27 {new ExpectedCell("row 4", 2)}, 28 }); 29 assertFail("assertTableEquals", new Object []{"testTable", badTable}); 30 } 31 32 private void addTestPage() { 33 defineWebPage("testPage", "This is a test page." + 34 "<table summary=\"testTable\">" + 35 "<tr><td>table text</td></tr>" + 36 "<tr><td>table text row 2</td></tr>" + 37 "<tr><td>table text row 3</td><td>row 3 col 1</td></tr>" + 38 "<tr><td colspan=\"2\">row 4</td></tr>" + 39 "</table>"); 40 defineWebPage("noFormPage", ""); 41 } 42 43 44 } 45 | Popular Tags |