KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.displaytag.jsptests;
2
3 import org.displaytag.test.DisplaytagCase;
4
5 import com.meterware.httpunit.GetMethodWebRequest;
6 import com.meterware.httpunit.TableRow;
7 import com.meterware.httpunit.WebRequest;
8 import com.meterware.httpunit.WebResponse;
9 import com.meterware.httpunit.WebTable;
10
11
12 /**
13  * Test for DISPL-192 - add row style to current row from TableDecorator.
14  * @author Fabrizio Giustina
15  * @version $Revision: 878 $ ($Author: fgiust $)
16  */

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

23     public String JavaDoc getJspName()
24     {
25         return "DISPL-192.jsp";
26     }
27
28     /**
29      * No exception when an invalid page is requested.
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         WebRequest request = new GetMethodWebRequest(jspName);
36
37         WebResponse response = runner.getResponse(request);
38
39         if (log.isDebugEnabled())
40         {
41             log.debug(response.getText());
42         }
43
44         WebTable[] tables = response.getTables();
45         assertEquals("Wrong number of tables in result.", 1, tables.length);
46         assertEquals("Wrong number of rows in result.", 4, tables[0].getRowCount());
47
48         if (log.isDebugEnabled())
49         {
50             log.debug(response.getText());
51         }
52
53         TableRow[] rows = tables[0].getRows();
54         assertEquals("Wrong number of rows in result.", 4, rows.length);
55
56         assertEquals("", rows[0].getClassName());
57         assertEquals("odd", rows[1].getClassName());
58         assertEquals("even", rows[2].getClassName());
59         assertEquals("odd highlighted", rows[3].getClassName());
60
61         assertEquals("", rows[0].getID());
62         assertEquals("rowid0", rows[1].getID());
63         assertEquals("rowid1", rows[2].getID());
64         assertEquals("rowid2", rows[3].getID());
65
66     }
67
68 }
Popular Tags