1 package org.displaytag.jsptests; 2 3 import org.displaytag.test.DisplaytagCase; 4 5 import com.meterware.httpunit.GetMethodWebRequest; 6 import com.meterware.httpunit.WebLink; 7 import com.meterware.httpunit.WebRequest; 8 import com.meterware.httpunit.WebResponse; 9 10 11 16 public class PaginationTest extends DisplaytagCase 17 { 18 19 22 public String getJspName() 23 { 24 return "pagination.jsp"; 25 } 26 27 33 public void doTest(String jspName) throws Exception 34 { 35 36 WebRequest request = new GetMethodWebRequest(jspName); 37 request.setParameter("{foo}", "/.,;:/||\\bar"); 38 39 WebResponse response = runner.getResponse(request); 40 41 if (log.isDebugEnabled()) 42 { 43 log.debug("RESPONSE: " + response.getText()); 44 } 45 46 WebLink[] links = response.getLinks(); 47 48 assertEquals("Wrong number of links in result.", 4, links.length); 49 50 for (int j = 0; j < links.length; j++) 51 { 52 assertTrue(links[j].getURLString().indexOf("{foo}=%2F.%2C%3B%3A%2F%7C%7C%5Cbar") > -1); 53 if (log.isDebugEnabled()) 54 { 55 log.debug(j + " " + links[j].getURLString()); 56 } 57 } 58 59 } 60 } | Popular Tags |