1 package org.displaytag.jsptests; 2 3 import org.displaytag.test.DisplaytagCase; 4 5 import com.meterware.httpunit.GetMethodWebRequest; 6 import com.meterware.httpunit.HTMLElement; 7 import com.meterware.httpunit.WebRequest; 8 import com.meterware.httpunit.WebResponse; 9 import com.meterware.httpunit.WebTable; 10 11 12 17 public class Displ199Test extends DisplaytagCase 18 { 19 20 23 public String getJspName() 24 { 25 return "DISPL-199.jsp"; 26 } 27 28 32 public void doTest(String jspName) throws Exception 33 { 34 35 WebRequest request = new GetMethodWebRequest(jspName); 36 37 WebResponse response = runner.getResponse(request); 38 39 if (log.isDebugEnabled()) 40 { 41 log.debug(response.getText()); 42 } 43 44 HTMLElement divtotal = response.getElementWithID("divtotal"); 45 assertEquals("7.0", divtotal.getText()); 46 47 WebTable[] tables = response.getTables(); 48 assertEquals("Wrong number of tables.", 1, tables.length); 49 WebTable table = tables[0]; 50 assertEquals("Wrong number of rows.", 5, table.getRowCount()); 51 assertEquals("Total not found in las row.", "7.0", table.getCellAsText(4, 0)); 52 53 } 54 55 } | Popular Tags |