1 package org.displaytag.jsptests; 2 3 import org.apache.commons.lang.StringUtils; 4 import org.displaytag.test.DisplaytagCase; 5 6 import com.meterware.httpunit.GetMethodWebRequest; 7 import com.meterware.httpunit.WebLink; 8 import com.meterware.httpunit.WebRequest; 9 import com.meterware.httpunit.WebResponse; 10 import com.meterware.httpunit.WebTable; 11 12 13 18 public class Displ264Test extends DisplaytagCase 19 { 20 21 24 public String getJspName() 25 { 26 return "DISPL-264.jsp"; 27 } 28 29 34 public void doTest(String jspName) throws Exception 35 { 36 WebRequest request = new GetMethodWebRequest(jspName); 37 request.setParameter("test", "value"); 38 WebResponse response = runner.getResponse(request); 39 40 if (log.isDebugEnabled()) 41 { 42 log.debug(response.getText()); 43 } 44 45 WebTable[] tables = response.getTables(); 46 assertEquals("Wrong number of tables in result.", 1, tables.length); 47 48 if (log.isDebugEnabled()) 49 { 50 log.debug(response.getText()); 51 } 52 53 WebLink[] links = response.getLinks(); 54 assertTrue("No links found.", links.length > 0); 55 String url = links[0].getURLString(); 56 assertTrue("Expected parameter not found in url " + url, StringUtils.contains(url, "test=value")); 57 } 58 59 } | Popular Tags |