1 package org.displaytag.jsptests; 2 3 import org.displaytag.properties.MediaTypeEnum; 4 import org.displaytag.tags.TableTagParameters; 5 import org.displaytag.test.DisplaytagCase; 6 import org.displaytag.test.URLAssert; 7 import org.displaytag.util.ParamEncoder; 8 9 import com.meterware.httpunit.GetMethodWebRequest; 10 import com.meterware.httpunit.WebLink; 11 import com.meterware.httpunit.WebRequest; 12 import com.meterware.httpunit.WebResponse; 13 import com.meterware.httpunit.WebTable; 14 15 16 21 public class RequestUriTest extends DisplaytagCase 22 { 23 24 27 public String getJspName() 28 { 29 return "requesturi.jsp"; 30 } 31 32 37 public void doTest(String jspName) throws Exception 38 { 39 WebRequest request = new GetMethodWebRequest(jspName); 40 41 WebResponse response = runner.getResponse(request); 42 if (log.isDebugEnabled()) 43 { 44 log.debug(response.getText()); 45 } 46 47 WebTable[] tables = response.getTables(); 48 assertEquals("Wrong number of tables.", 1, tables.length); 49 50 WebLink[] links = response.getLinks(); 51 assertEquals("Wrong number of links in result.", MediaTypeEnum.getSize() - 1 , 53 links.length); 54 55 URLAssert.assertEquals(CONTEXT 56 + "/goforit?" 57 + new ParamEncoder("table").encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE) 58 + "=1&" 59 + TableTagParameters.PARAMETER_EXPORTING 60 + "=1", links[0].getURLString()); 61 } 62 63 } | Popular Tags |