1 package org.displaytag.jsptests; 2 3 import org.displaytag.test.DisplaytagCase; 4 5 import com.meterware.httpunit.GetMethodWebRequest; 6 import com.meterware.httpunit.WebRequest; 7 import com.meterware.httpunit.WebResponse; 8 import com.meterware.httpunit.WebTable; 9 10 11 16 public class Displ002Test extends DisplaytagCase 17 { 18 19 22 public String getJspName() 23 { 24 return "DISPL-002.jsp"; 25 } 26 27 32 public void doTest(String jspName) throws Exception 33 { 34 WebRequest request = new GetMethodWebRequest(jspName); 35 WebResponse response; 36 37 response = runner.getResponse(request); 38 39 if (log.isDebugEnabled()) 40 { 41 log.debug(response.getText()); 42 } 43 44 WebTable[] tables = response.getTables(); 45 assertEquals("Wrong number of tables in result.", 4, tables.length); 46 47 for (int j = 0; j < tables.length; j++) 48 { 49 WebTable table = tables[j]; 50 assertEquals("Wrong number of rows in table " + (j + 1), 2, table.getRowCount()); 51 assertEquals("Wrong content in cell for table " + (j + 1), "ant", table.getCellAsText(1, 0)); 52 assertEquals("Wrong content in cell for table " + (j + 1), "bee", table.getCellAsText(1, 1)); 53 } 54 } 55 } | Popular Tags |