KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.displaytag.jsptests;
2
3 import org.displaytag.test.DisplaytagCase;
4
5 import com.meterware.httpunit.GetMethodWebRequest;
6 import com.meterware.httpunit.WebRequest;
7 import com.meterware.httpunit.WebResponse;
8 import com.meterware.httpunit.WebTable;
9
10
11 /**
12  * Tests for DISPL-81 - using ColumnDecorator with tag body.
13  * @author Fabrizio Giustina
14  * @version $Revision: 876 $ ($Author: fgiust $)
15  */

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

22     public String JavaDoc getJspName()
23     {
24         return "DISPL-081.jsp";
25     }
26
27     /**
28      * Check that column body is decorated.
29      * @param jspName jsp name, with full path
30      * @throws Exception any axception thrown during test.
31      */

32     public void doTest(String JavaDoc jspName) throws Exception JavaDoc
33     {
34         WebRequest request = new GetMethodWebRequest(jspName);
35         WebResponse response = runner.getResponse(request);
36
37         WebTable[] tables = response.getTables();
38         assertEquals("Wrong number of tables.", 1, tables.length);
39
40         assertEquals("Wrong number of columns.", 2, tables[0].getColumnCount());
41         assertEquals("Wrong number of rows.", 2, tables[0].getRowCount());
42
43         assertEquals("Wrong text in column 1", "decorated: ant", tables[0].getCellAsText(1, 0));
44         assertEquals("Wrong text in column 2", "decorated: body", tables[0].getCellAsText(1, 1));
45     }
46
47 }
Popular Tags