1 package org.displaytag.jsptests; 2 3 import org.displaytag.tags.TableTagParameters; 4 import org.displaytag.test.DisplaytagCase; 5 import org.displaytag.util.ParamEncoder; 6 7 import com.meterware.httpunit.GetMethodWebRequest; 8 import com.meterware.httpunit.WebLink; 9 import com.meterware.httpunit.WebRequest; 10 import com.meterware.httpunit.WebResponse; 11 import com.meterware.httpunit.WebTable; 12 13 14 19 public class Displ074Test extends DisplaytagCase 20 { 21 22 25 public String getJspName() 26 { 27 return "DISPL-074.jsp"; 28 } 29 30 35 public void doTest(String jspName) throws Exception 36 { 37 WebRequest request = new GetMethodWebRequest(jspName); 38 WebResponse response = runner.getResponse(request); 39 40 ParamEncoder encoder = new ParamEncoder("table"); 41 request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2"); 42 43 if (log.isDebugEnabled()) 44 { 45 log.debug(response.getText()); 46 } 47 48 WebTable[] tables = response.getTables(); 49 assertEquals("Wrong number of tables in result.", 1, tables.length); 50 assertEquals("Wrong number of rows in result.", 2, tables[0].getRowCount()); 51 52 if (log.isDebugEnabled()) 53 { 54 log.debug(response.getText()); 55 } 56 57 assertEquals("Wrong column content.", "ant", tables[0].getCellAsText(1, 0)); 58 assertEquals("Wrong column content.", "bee", tables[0].getCellAsText(1, 1)); 59 60 WebLink[] links = response.getLinks(); 61 assertEquals("Wrong number of links", 2, links.length); 62 } 63 64 } | Popular Tags |