KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.displaytag.jsptests;
2
3 import org.displaytag.test.DisplaytagCase;
4 import org.displaytag.test.KnownValue;
5
6 import com.meterware.httpunit.GetMethodWebRequest;
7 import com.meterware.httpunit.WebRequest;
8 import com.meterware.httpunit.WebResponse;
9 import com.meterware.httpunit.WebTable;
10
11
12 /**
13  * Tests for basic displaytag functionalities.
14  * @author Fabrizio Giustina
15  * @version $Revision: 894 $ ($Author: fgiust $)
16  */

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

23     public String JavaDoc getJspName()
24     {
25         return "group.jsp";
26     }
27
28     /**
29      * Tests row grouping. bug #923446
30      * @param jspName jsp name, with full path
31      * @throws Exception any axception thrown during test.
32      */

33     public void doTest(String JavaDoc jspName) throws Exception JavaDoc
34     {
35
36         WebRequest request = new GetMethodWebRequest(jspName);
37
38         WebResponse response = runner.getResponse(request);
39
40         if (log.isDebugEnabled())
41         {
42             log.debug("RESPONSE: " + response.getText());
43         }
44
45         WebTable[] tables = response.getTables();
46
47         assertEquals("Wrong number of tables.", 1, tables.length);
48         assertEquals("Wrong number of rows in table.", 3, tables[0].getRowCount());
49
50         assertEquals("Column not grouped.", "", tables[0].getCellAsText(2, 0));
51         assertEquals("Column not grouped.", "", tables[0].getCellAsText(2, 1));
52         assertEquals("Column should not be grouped.", KnownValue.CAMEL, tables[0].getCellAsText(2, 2));
53     }
54 }
Popular Tags