KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cactus > sample > servlet > unit > TestJUnitTestCaseWrapper


1 /*
2  * ========================================================================
3  *
4  * Copyright 2001-2003 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * ========================================================================
19  */

20 package org.apache.cactus.sample.servlet.unit;
21
22 import org.apache.cactus.ServletTestSuite;
23
24 import junit.framework.Test;
25 import junit.framework.TestCase;
26
27 /**
28  * Pure JUnit Test Case that we run on the server side using Cactus, by
29  * using a {@link ServletTestSuite}.
30  *
31  * @version $Id: TestJUnitTestCaseWrapper.java,v 1.3 2004/02/29 16:36:44 vmassol Exp $
32  */

33 public class TestJUnitTestCaseWrapper extends TestCase
34 {
35     /**
36      * Used to verify that the setUp method does get called.
37      */

38     private boolean isSetUpCalled;
39
40     /**
41      * Used to verify that the testXXX method does get called.
42      */

43     private boolean isTestXXXCalled;
44     
45     /**
46      * Runs this pure JUnit Test Case with Cactus, wrapping it in
47      * a Servlet Test Case.
48      *
49      * @return the test suite containing all tests to run
50      */

51     public static Test suite()
52     {
53         ServletTestSuite suite = new ServletTestSuite();
54         suite.addTestSuite(TestJUnitTestCaseWrapper.class);
55         return suite;
56     }
57
58     //-------------------------------------------------------------------------
59

60     /**
61      * No-op test just to verify that pure JUnit tests can be executed on the
62      * server side using Cactus.
63      */

64     public void setUp()
65     {
66         this.isSetUpCalled = true;
67     }
68     
69     /**
70      * No-op test just to verify that pure JUnit tests can be executed on the
71      * server side using Cactus.
72      */

73     public void testXXX()
74     {
75         assertTrue("setUp() should have been called", this.isSetUpCalled);
76         this.isTestXXXCalled = true;
77     }
78
79     /**
80      * No-op test just to verify that pure JUnit tests can be executed on the
81      * server side using Cactus.
82      */

83     public void tearDown()
84     {
85         assertTrue("testXXX() should have been called", this.isTestXXXCalled);
86     }
87
88 }
89
Popular Tags