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 /** 16 * Test for DISPL-249 - Link generated for results navigation is breaking national character taken from FormBean. 17 * @author Fabrizio Giustina 18 * @version $Revision$ ($Author$) 19 */ 20 public class Displ249Test extends DisplaytagCase 21 { 22 23 /** 24 * @see org.displaytag.test.DisplaytagCase#getJspName() 25 */ 26 public String getJspName() 27 { 28 return "DISPL-249.jsp"; 29 } 30 31 /** 32 * Link generated for results navigation is breaking national character taken from FormBean. 33 * @param jspName jsp name, with full path 34 * @throws Exception any axception thrown during test. 35 */ 36 public void doTest(String jspName) throws Exception 37 { 38 WebRequest request = new PostMethodWebRequest(jspName); // use post 39 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); // sorting + paging 54 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 }