1 package org.displaytag.jsptests; 2 3 import org.displaytag.tags.TableTagParameters; 4 import org.displaytag.test.DisplaytagCase; 5 import org.displaytag.test.URLAssert; 6 import org.displaytag.util.ParamEncoder; 7 8 import com.meterware.httpunit.GetMethodWebRequest; 9 import com.meterware.httpunit.WebLink; 10 import com.meterware.httpunit.WebRequest; 11 import com.meterware.httpunit.WebResponse; 12 import com.meterware.httpunit.WebTable; 13 14 15 20 public class Displ117Test extends DisplaytagCase 21 { 22 23 26 public String getJspName() 27 { 28 return "DISPL-117.jsp"; 29 } 30 31 36 public void doTest(String jspName) throws Exception 37 { 38 WebRequest request = new GetMethodWebRequest(jspName); 39 ParamEncoder encoder = new ParamEncoder("table"); 40 request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER), "2"); 41 request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "0"); 42 43 WebResponse response = runner.getResponse(request); 44 45 if (log.isDebugEnabled()) 46 { 47 log.debug(response.getText()); 48 } 49 50 WebTable[] tables = response.getTables(); 51 assertEquals("Wrong number of tables.", 1, tables.length); 52 53 WebLink[] links = response.getLinks(); 54 assertEquals("Wrong number of links in result.", 1, links.length); 55 56 URLAssert.assertEquals("/context/goforit?param=ant&d-148916-s=0&d-148916-o=2", links[0].getURLString()); 57 } 58 59 } | Popular Tags |