KickJava   Java API By Example, From Geeks To Geeks.

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


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 the htmlId attribute.
13  * @author Fabrizio Giustina
14  * @version $Revision: 707 $ ($Author: fgiust $)
15  */

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

22     public String JavaDoc getJspName()
23     {
24         return "htmlid.jsp";
25     }
26
27     /**
28      * Check content and ids in generated tables.
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;
36
37         response = runner.getResponse(request);
38
39         WebTable[] tables = response.getTables();
40         assertEquals("Wrong number of tables in result.", 3, tables.length);
41
42         for (int j = 0; j < tables.length; j++)
43         {
44             assertEquals("invalid id", "html" + (j + 1), tables[j].getID());
45             assertEquals("Unexpected value in table cell", "bee", tables[j].getCellAsText(1, 0));
46         }
47
48     }
49 }
Popular Tags