1 package org.displaytag.jsptests; 2 3 import org.displaytag.tags.TableTagParameters; 4 import org.displaytag.test.DisplaytagCase; 5 import org.displaytag.util.ParamEncoder; 6 7 import com.meterware.httpunit.GetMethodWebRequest; 8 import com.meterware.httpunit.HTMLElement; 9 import com.meterware.httpunit.WebRequest; 10 import com.meterware.httpunit.WebResponse; 11 12 13 /** 14 * Test for DISPL-232 - paging.banner.full: {6} is not the total number of pages. 15 * @author Fabrizio Giustina 16 * @version $Revision$ ($Author$) 17 */ 18 public class Displ232Test extends DisplaytagCase 19 { 20 21 /** 22 * @see org.displaytag.test.DisplaytagCase#getJspName() 23 */ 24 public String getJspName() 25 { 26 return "DISPL-232.jsp"; 27 } 28 29 /** 30 * Paging banner should contain [10] 31 * @param jspName jsp name, with full path 32 * @throws Exception any axception thrown during test. 33 */ 34 public void doTest(String jspName) throws Exception 35 { 36 WebRequest request = new GetMethodWebRequest(jspName); 37 ParamEncoder encoder = new ParamEncoder("table"); 38 request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "3"); 39 40 WebResponse response = runner.getResponse(request); 41 42 if (log.isDebugEnabled()) 43 { 44 log.debug(response.getText()); 45 } 46 47 HTMLElement pagination = response.getElementWithID("pagination"); 48 assertNotNull("Paging banner not found.", pagination); 49 assertEquals("Total number of pages is not displayted properly.", "[10]", pagination.getText()); 50 51 request = new GetMethodWebRequest(jspName); 52 request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "10"); 53 response = runner.getResponse(request); 54 55 if (log.isDebugEnabled()) 56 { 57 log.debug(response.getText()); 58 } 59 60 pagination = response.getElementWithID("pagination"); 61 assertNotNull("Paging banner not found.", pagination); 62 assertEquals("Total number of pages is not displayted properly.", "[10]", pagination.getText()); 63 64 } 65 66 }