KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > web > PageStackTest


1 package com.tonbeller.wcf.web;
2
3 import com.meterware.httpunit.GetMethodWebRequest;
4 import com.meterware.httpunit.WebLink;
5 import com.meterware.httpunit.WebResponse;
6
7
8 public class PageStackTest extends HttpUnitTestCase {
9
10   public PageStackTest(String JavaDoc arg0) {
11     super(arg0);
12   }
13
14   public void testPage() throws Exception JavaDoc {
15     wc.sendRequest(new GetMethodWebRequest(servletUrl + "/pagestack.jsp"));
16     utils.check("pagestack-01", "filter.xsl", "body");
17   }
18   
19   public void testToken() throws Exception JavaDoc {
20     wc.sendRequest(new GetMethodWebRequest(servletUrl + "/pagestack.jsp"));
21     // redirect does not work with httpunit 1.5.2?
22
WebResponse wr = wc.getCurrentPage();
23     WebLink l1 = wr.getFirstMatchingLink(WebLink.MATCH_URL_STRING, "token1.jsp");
24     assertNotNull(l1.getParameterValues("token"));
25     WebLink l2 = wr.getFirstMatchingLink(WebLink.MATCH_URL_STRING, "token2.jsp");
26     assertNotNull(l2.getParameterValues("token"));
27     WebLink l3 = wr.getFirstMatchingLink(WebLink.MATCH_URL_STRING, "token3.jsp");
28     assertNotNull(l3.getParameterValues("token"));
29   }
30 }
31
Popular Tags