KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > cactus > TestSampleServlet


1 package org.tigris.scarab.cactus;
2
3 import junit.framework.Test;
4 import junit.framework.TestSuite;
5
6 import org.apache.cactus.ServletTestCase;
7 import org.apache.cactus.WebRequest;
8
9
10 /**
11  *
12  * Sample test, just to test the tests ;-)
13  *
14  */

15 public class TestSampleServlet extends ServletTestCase
16 {
17     public TestSampleServlet(String JavaDoc theName)
18     {
19         super(theName);
20     }
21
22     public static Test suite()
23     {
24         return new TestSuite(TestSampleServlet.class);
25     }
26
27     public void beginSaveToSessionOK(WebRequest webRequest)
28     {
29         webRequest.addParameter("testparam", "it works!");
30     }
31
32     public void testSaveToSessionOK()
33     {
34         SampleServlet servlet = new SampleServlet();
35         servlet.saveToSession(request);
36         assertEquals("it works!", session.getAttribute("testAttribute"));
37     }
38 }
39
Popular Tags