KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

23     public String JavaDoc getJspName()
24     {
25         return "DISPL-001.jsp";
26     }
27
28     /**
29      * Check the content of the title attribute.
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         WebResponse response = runner.getResponse(request);
37
38         WebTable[] tables = response.getTables();
39         assertEquals("Expected 1 table in result.", 1, tables.length);
40         assertEquals("Wrong title in column", "averylongemail@mail.com", tables[0].getTableCell(1, 0).getTitle());
41
42         WebLink[] links = tables[0].getTableCell(1, 0).getLinks();
43         assertEquals("Expected link not found", 1, links.length);
44         assertEquals("Wrong text in link", "averylongemail@...", links[0].getText());
45         assertEquals("Wrong url in link", "mailto:averylongemail@mail.com", links[0].getURLString());
46     }
47
48 }
Popular Tags