KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > jwebunit > WebCookieTest


1 package net.sourceforge.jwebunit;
2
3 import net.sourceforge.jwebunit.JWebUnitTest;
4
5 /**
6  * Test the Cookies provided by WebTestCase using the PseudoServer test package provided
7  * by Russell Gold in httpunit.
8  *
9  * @author Vivek Venugopalan
10  */

11 public class WebCookieTest extends JWebUnitTest {
12
13     public void setUp() throws Exception JavaDoc {
14         getTestContext().addCookie("cookie1", "Cookievalue1");
15         super.setUp();
16         addTestPage();
17         beginAt("/testPage.html");
18     }
19
20
21     public void testAssertCookieDump() throws Throwable JavaDoc {
22             dumpCookies();
23     }
24
25     private void addTestPage() {
26         defineWebPage("testPage", "This is a test page." +
27                 "<table summary=\"testTable\">" +
28                 "<tr ID=\"row1\"><td>table text</td></tr>" +
29                 "<tr><td>table text row 2</td></tr>" +
30                 "<tr><td>table text row 3</td><td>row 3 col 1</td>" +
31                 "<a id=\"test_link_id\" HREF=\"someurl.html\">test link</a>" +
32                 "<a id=\"test_graphic_link_id\" HREF=\"someurl2.html\"><img SRC=\"graphic.jpg\"/></a>" +
33                 "<form>" +
34                 "<input type=\"text\" name=\"testInputElement\" value=\"testValue\"/>" +
35                 "<input type=\"submit\" name=\"submitButton\" value=\"buttonLabel\"/>" +
36                 "<input type=\"checkbox\" name=\"checkboxselected\" CHECKED>" +
37                 "<input type=\"checkbox\" name=\"checkboxnotselected\">" +
38                 "</form>" +
39                 "<span id=\"span_id\">Span Text</span>" +
40                 "<span id=\"outer_id\">Outer <span id=\"inner_id\">Inner Text</span> Text</span>" +
41                 "<form name=\"form2\"></form>" +
42         "</table>");
43         defineWebPage("noFormPage", "");
44     }
45 }
46
Popular Tags