KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > taglib > html > TestBaseTag


1 /*
2  * $Id: TestBaseTag.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 1999-2004 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 package org.apache.struts.taglib.html;
19
20 import junit.framework.Test;
21 import junit.framework.TestSuite;
22
23 import org.apache.struts.taglib.TaglibTestBase;
24
25
26
27 /**
28  * Suite of unit tests for the
29  * <code>org.apache.struts.taglib.html.BaseTag</code> class.
30  *
31  */

32 public class TestBaseTag extends TaglibTestBase {
33
34     /**
35      * Defines the testcase name for JUnit.
36      *
37      * @param theName the testcase's name.
38      */

39     public TestBaseTag(String JavaDoc theName) {
40         super(theName);
41     }
42
43     /**
44      * Start the tests.
45      *
46      * @param theArgs the arguments. Not used
47      */

48     public static void main(String JavaDoc[] theArgs) {
49         junit.awtui.TestRunner.main(new String JavaDoc[] {TestBaseTag.class.getName()});
50     }
51
52     /**
53      * @return a test suite (<code>TestSuite</code>) that includes all methods
54      * starting with "test"
55      */

56     public static Test suite() {
57         // All methods starting with "test" will be executed in the test suite.
58
return new TestSuite(TestBaseTag.class);
59     }
60
61     private void runMyTest(String JavaDoc whichTest) throws Exception JavaDoc {
62         request.setAttribute("runTest", whichTest);
63         pageContext.forward("/test/org/apache/struts/taglib/html/TestBaseTag.jsp");
64     }
65     
66     /*
67      * Testing BaseTag.
68      */

69     public void testBase() throws Exception JavaDoc {
70         runMyTest("testBase");
71         }
72
73     public void testBaseTarget() throws Exception JavaDoc {
74         runMyTest("testBaseTarget");
75         }
76
77     public void testBaseServer() throws Exception JavaDoc {
78         runMyTest("testBaseServer");
79         }
80
81     public void testBaseServerTarget() throws Exception JavaDoc {
82         runMyTest("testBaseServerTarget");
83         }
84
85 }
86
Popular Tags