KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Test for DISPL-279 - new "value" column attribute.
13  * @author Fabrizio Giustina
14  * @version $Id$
15  */

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

22     public String JavaDoc getJspName()
23     {
24         return "DISPL-279.jsp";
25     }
26
27     /**
28      * Check column values.
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         if (log.isDebugEnabled())
38         {
39             log.debug(response.getText());
40         }
41
42         WebTable[] tables = response.getTables();
43         assertEquals("Wrong number of tables in result.", 1, tables.length);
44
45         if (log.isDebugEnabled())
46         {
47             log.debug(response.getText());
48         }
49
50         assertEquals("Wrong number of rows.", 2, tables[0].getRowCount());
51         assertEquals("Wrong number of columns.", 3, tables[0].getColumnCount());
52
53         assertEquals("Wrong value in cell.", "ant", tables[0].getCellAsText(1, 0));
54         assertEquals("Wrong value in cell.", "1", tables[0].getCellAsText(1, 1));
55         assertEquals("Wrong value in cell.", "1 $", tables[0].getCellAsText(1, 2));
56
57     }
58
59 }
Popular Tags