KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.displaytag.jsptests;
2
3 import org.displaytag.test.DisplaytagCase;
4
5 import com.meterware.httpunit.GetMethodWebRequest;
6 import com.meterware.httpunit.HTMLElement;
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-199 - Column Summation
14  * @author Fabrizio Giustina
15  * @version $Id$
16  */

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

23     public String JavaDoc getJspName()
24     {
25         return "DISPL-199.jsp";
26     }
27
28     /**
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
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         HTMLElement divtotal = response.getElementWithID("divtotal");
45         assertEquals("7.0", divtotal.getText());
46
47         WebTable[] tables = response.getTables();
48         assertEquals("Wrong number of tables.", 1, tables.length);
49         WebTable table = tables[0];
50         assertEquals("Wrong number of rows.", 5, table.getRowCount());
51         assertEquals("Total not found in las row.", "7.0", table.getCellAsText(4, 0));
52
53     }
54
55 }
Popular Tags