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.util.ParamEncoder; 7 8 import com.meterware.httpunit.GetMethodWebRequest; 9 import com.meterware.httpunit.WebRequest; 10 import com.meterware.httpunit.WebResponse; 11 12 13 18 public class ExportFullTest extends DisplaytagCase 19 { 20 21 24 public String getJspName() 25 { 26 return "exportfull.jsp"; 27 } 28 29 34 public void doTest(String jspName) throws Exception 35 { 36 37 ParamEncoder encoder = new ParamEncoder("table"); 38 String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE); 39 40 WebRequest request = new GetMethodWebRequest(jspName); 41 request.setParameter(mediaParameter, Integer.toString(MediaTypeEnum.CSV.getCode())); 42 43 WebResponse response = runner.getResponse(request); 44 45 assertEquals("Expected a different content type.", "text/csv", response.getContentType()); 47 assertEquals("Wrong content.", "1\n2\n3\n", response.getText()); 48 } 49 50 } | Popular Tags |