KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > displaytag > jsptests > Displ220Test


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.WebRequest;
9 import com.meterware.httpunit.WebResponse;
10 import com.meterware.httpunit.WebTable;
11
12
13 /**
14  * Test for DISPL-220 - Case-insensitive sorting.
15  * @author Fabrizio Giustina
16  * @version $Id$
17  */

18 public class Displ220Test extends DisplaytagCase
19 {
20
21     /**
22      * @see org.displaytag.test.DisplaytagCase#getJspName()
23      */

24     public String JavaDoc getJspName()
25     {
26         return "DISPL-220.jsp";
27     }
28
29     /**
30      * No exception when an invalid page is requested.
31      * @param jspName jsp name, with full path
32      * @throws Exception any axception thrown during test.
33      */

34     public void doTest(String JavaDoc jspName) throws Exception JavaDoc
35     {
36         WebRequest request = new GetMethodWebRequest(jspName);
37         WebResponse response = runner.getResponse(request);
38
39         ParamEncoder encoder = new ParamEncoder("table");
40         request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
41
42         if (log.isDebugEnabled())
43         {
44             log.debug(response.getText());
45         }
46
47         WebTable[] tables = response.getTables();
48         assertEquals("Wrong number of tables in result.", 1, tables.length);
49         assertEquals("Wrong number of rows in result.", 6, tables[0].getRowCount());
50
51         if (log.isDebugEnabled())
52         {
53             log.debug(response.getText());
54         }
55
56         assertEquals("Wrong column content.", "aaa", tables[0].getCellAsText(1, 0));
57         assertEquals("Wrong column content.", "AAb", tables[0].getCellAsText(2, 0));
58         assertEquals("Wrong column content.", "àAc", tables[0].getCellAsText(3, 0));
59         assertEquals("Wrong column content.", "Aàd", tables[0].getCellAsText(4, 0));
60         assertEquals("Wrong column content.", "bbb", tables[0].getCellAsText(5, 0));
61     }
62
63 }
Popular Tags