1 package org.displaytag.jsptests; 2 3 import java.net.URLDecoder ; 4 5 import org.apache.commons.lang.StringUtils; 6 import org.displaytag.test.DisplaytagCase; 7 8 import com.meterware.httpunit.PostMethodWebRequest; 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 Displ249Test extends DisplaytagCase 21 { 22 23 26 public String getJspName() 27 { 28 return "DISPL-249.jsp"; 29 } 30 31 36 public void doTest(String jspName) throws Exception 37 { 38 WebRequest request = new PostMethodWebRequest(jspName); String paramValue = "aàeèiìoòuù"; 40 request.setParameter("testparam", paramValue); 41 42 WebResponse response = runner.getResponse(request); 43 44 if (log.isDebugEnabled()) 45 { 46 log.debug(response.getText()); 47 } 48 49 WebTable[] tables = response.getTables(); 50 assertEquals("Wrong number of tables", 1, tables.length); 51 52 WebLink[] links = response.getLinks(); 53 assertEquals("Wrong number of links", 3, links.length); 55 String url = URLDecoder.decode(links[0].getURLString(), "UTF-8"); 56 57 assertTrue("Param value not found in generated links.", StringUtils.contains(url, paramValue)); 58 59 } 60 61 } | Popular Tags |