1 package org.displaytag.jsptests; 2 3 import org.displaytag.properties.SortOrderEnum; 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.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 Displ208Test extends DisplaytagCase 21 { 22 23 26 public String getJspName() 27 { 28 return "DISPL-208.jsp"; 29 } 30 31 36 public void doTest(String jspName) throws Exception 37 { 38 WebRequest request = new GetMethodWebRequest(jspName); 39 40 WebResponse response = runner.getResponse(request); 41 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.", 3, links.length); 52 53 ParamEncoder encoder = new ParamEncoder("table"); 54 String orderParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER); 55 56 assertEquals("wrong sorting order", Integer.toString(SortOrderEnum.DESCENDING.getCode()), links[0] 57 .getParameterValues(orderParameter)[0]); 58 assertEquals("wrong sorting order", Integer.toString(SortOrderEnum.ASCENDING.getCode()), links[1] 59 .getParameterValues(orderParameter)[0]); 60 assertEquals("wrong sorting order", Integer.toString(SortOrderEnum.ASCENDING.getCode()), links[2] 61 .getParameterValues(orderParameter)[0]); 62 63 } 64 65 } | Popular Tags |