KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TestCheckboxTag1.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 java.util.Locale JavaDoc;
21
22 import javax.servlet.jsp.PageContext JavaDoc;
23 import junit.framework.Test;
24 import junit.framework.TestSuite;
25
26 import org.apache.cactus.JspTestCase;
27 import org.apache.struts.Globals;
28 import org.apache.struts.taglib.SimpleBeanForTesting;
29
30 /**
31  * Suite of unit tests for the
32  * <code>org.apache.struts.taglib.html.CheckboxTag</code> class.
33  * NOTE - These tests were separated into 4 files each because of the
34  * size of the jsp. (not playing well with Tomcat 3.3
35  *
36  * These tests are numbered as such:
37  *
38  * TestCheckboxTag(1 and 2) - These test using a boolean property
39  * set to true on our form.
40  *
41  * TestCheckboxTag(3 and 4) - These test using a boolean property
42  * set to false on our form.
43  *
44  */

45 public class TestCheckboxTag1 extends JspTestCase {
46
47     /**
48      * Defines the testcase name for JUnit.
49      *
50      * @param theName the testcase's name.
51      */

52     public TestCheckboxTag1(String JavaDoc theName) {
53         super(theName);
54     }
55
56     /**
57      * Start the tests.
58      *
59      * @param theArgs the arguments. Not used
60      */

61     public static void main(String JavaDoc[] theArgs) {
62         junit.awtui.TestRunner.main(new String JavaDoc[] {TestCheckboxTag1.class.getName()});
63     }
64
65     /**
66      * @return a test suite (<code>TestSuite</code>) that includes all methods
67      * starting with "test"
68      */

69     public static Test suite() {
70         // All methods starting with "test" will be executed in the test suite.
71
return new TestSuite(TestCheckboxTag1.class);
72     }
73
74     private void runMyTest(String JavaDoc whichTest, String JavaDoc locale) throws Exception JavaDoc {
75         pageContext.setAttribute(Globals.LOCALE_KEY, new Locale JavaDoc(locale, locale), PageContext.SESSION_SCOPE);
76         pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting(true), PageContext.REQUEST_SCOPE);
77         request.setAttribute("runTest", whichTest);
78         pageContext.forward("/test/org/apache/struts/taglib/html/TestCheckboxTag1.jsp");
79     }
80
81     /*
82      * Testing CheckboxTag.
83      */

84     public void testCheckboxPropertybooleanTrue() throws Exception JavaDoc {
85         runMyTest("testCheckboxPropertybooleanTrue", "");
86         }
87     public void testCheckboxPropertybooleanTrueAccesskey() throws Exception JavaDoc {
88         runMyTest("testCheckboxPropertybooleanTrueAccesskey", "");
89         }
90     public void testCheckboxPropertybooleanTrueAlt() throws Exception JavaDoc {
91         runMyTest("testCheckboxPropertybooleanTrueAlt", "");
92         }
93     public void testCheckboxPropertybooleanTrueAltKey1() throws Exception JavaDoc {
94         runMyTest("testCheckboxPropertybooleanTrueAltKey1", "");
95         }
96     public void testCheckboxPropertybooleanTrueAltKey2() throws Exception JavaDoc {
97         runMyTest("testCheckboxPropertybooleanTrueAltKey2", "");
98         }
99     public void testCheckboxPropertybooleanTrueAltKey3() throws Exception JavaDoc {
100         runMyTest("testCheckboxPropertybooleanTrueAltKey3", "");
101     }
102     public void testCheckboxPropertybooleanTrueAltKey_fr1() throws Exception JavaDoc {
103         runMyTest("testCheckboxPropertybooleanTrueAltKey1_fr", "fr");
104         }
105     public void testCheckboxPropertybooleanTrueAltKey_fr2() throws Exception JavaDoc {
106         runMyTest("testCheckboxPropertybooleanTrueAltKey2_fr", "fr");
107         }
108     public void testCheckboxPropertybooleanTrueDisabled_True() throws Exception JavaDoc {
109         runMyTest("testCheckboxPropertybooleanTrueDisabled_True", "");
110         }
111     public void testCheckboxPropertybooleanTrueDisabled_False1() throws Exception JavaDoc {
112         runMyTest("testCheckboxPropertybooleanTrueDisabled_False1", "");
113         }
114     public void testCheckboxPropertybooleanTrueDisabled_False2() throws Exception JavaDoc {
115         runMyTest("testCheckboxPropertybooleanTrueDisabled_False2", "");
116         }
117     public void testCheckboxPropertybooleanTrueOnblur() throws Exception JavaDoc {
118         runMyTest("testCheckboxPropertybooleanTrueOnblur", "");
119         }
120
121     public void testCheckboxPropertybooleanTrueOnchange() throws Exception JavaDoc {
122         runMyTest("testCheckboxPropertybooleanTrueOnchange", "");
123         }
124
125     public void testCheckboxPropertybooleanTrueOnclick() throws Exception JavaDoc {
126         runMyTest("testCheckboxPropertybooleanTrueOnclick", "");
127         }
128
129     public void testCheckboxPropertybooleanTrueOndblclick() throws Exception JavaDoc {
130         runMyTest("testCheckboxPropertybooleanTrueOndblclick", "");
131         }
132
133     public void testCheckboxPropertybooleanTrueOnfocus() throws Exception JavaDoc {
134         runMyTest("testCheckboxPropertybooleanTrueOnfocus", "");
135         }
136
137     public void testCheckboxPropertybooleanTrueOnkeydown() throws Exception JavaDoc {
138         runMyTest("testCheckboxPropertybooleanTrueOnkeydown", "");
139         }
140
141     public void testCheckboxPropertybooleanTrueOnkeypress() throws Exception JavaDoc {
142         runMyTest("testCheckboxPropertybooleanTrueOnkeypress", "");
143         }
144
145     public void testCheckboxPropertybooleanTrueOnkeyup() throws Exception JavaDoc {
146         runMyTest("testCheckboxPropertybooleanTrueOnkeyup", "");
147         }
148
149     public void testCheckboxPropertybooleanTrueOnmousedown() throws Exception JavaDoc {
150         runMyTest("testCheckboxPropertybooleanTrueOnmousedown", "");
151         }
152
153     public void testCheckboxPropertybooleanTrueOnmousemove() throws Exception JavaDoc {
154         runMyTest("testCheckboxPropertybooleanTrueOnmousemove", "");
155         }
156
157     public void testCheckboxPropertybooleanTrueOnmouseout() throws Exception JavaDoc {
158         runMyTest("testCheckboxPropertybooleanTrueOnmouseout", "");
159         }
160
161     public void testCheckboxPropertybooleanTrueOnmouseover() throws Exception JavaDoc {
162         runMyTest("testCheckboxPropertybooleanTrueOnmouseover", "");
163         }
164
165     public void testCheckboxPropertybooleanTrueOnmouseup() throws Exception JavaDoc {
166         runMyTest("testCheckboxPropertybooleanTrueOnmouseup", "");
167         }
168
169 }
170
Popular Tags