KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TestMultiboxTag4.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.MultiboxTag</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  * 1 thru 4 test a single checkbox
39  * TestMultiboxTag1 - These test validate true (a value was in the array) on our form.
40  * TestMultiboxTag2 - Same as 1, but using BodyContent instead of value attribute
41  *
42  * TestMultiboxTag3 - These test validate true (a value was in the array) on our form.
43  * TestMultiboxTag4 - Same as 3, but using BodyContent instead of value attribute
44  *
45  * 5 thru 8 test multiple checkboxes
46  * TestMultiboxTag5 - These test validate true (a value was in the array) on our form.
47  * TestMultiboxTag6 - Same as 5, but using BodyContent instead of value attribute
48  *
49  * TestMultiboxTag7 - These test validate true (a value was in the array) on our form.
50  * TestMultiboxTag8 - Same as 7, but using BodyContent instead of value attribute
51  *
52  *
53  */

54 public class TestMultiboxTag4 extends JspTestCase {
55
56     /**
57      * Defines the testcase name for JUnit.
58      *
59      * @param theName the testcase's name.
60      */

61     public TestMultiboxTag4(String JavaDoc theName) {
62         super(theName);
63     }
64
65     /**
66      * Start the tests.
67      *
68      * @param theArgs the arguments. Not used
69      */

70     public static void main(String JavaDoc[] theArgs) {
71         junit.awtui.TestRunner.main(new String JavaDoc[] {TestMultiboxTag4.class.getName()});
72     }
73
74     /**
75      * @return a test suite (<code>TestSuite</code>) that includes all methods
76      * starting with "test"
77      */

78     public static Test suite() {
79         // All methods starting with "test" will be executed in the test suite.
80
return new TestSuite(TestMultiboxTag4.class);
81     }
82
83     private void runMyTest(String JavaDoc whichTest, String JavaDoc locale) throws Exception JavaDoc {
84         pageContext.setAttribute(Globals.LOCALE_KEY,
85                         new Locale JavaDoc(locale, locale),
86                         PageContext.SESSION_SCOPE);
87
88                 String JavaDoc[] s = new String JavaDoc[7];
89                 for(int i = 1; i < 7; i++){
90                         s[i] = "value" + i;
91                 }
92                 SimpleBeanForTesting sbft = new SimpleBeanForTesting(s);
93
94         pageContext.setAttribute(Constants.BEAN_KEY, sbft, PageContext.REQUEST_SCOPE);
95         request.setAttribute("runTest", whichTest);
96         pageContext.forward("/test/org/apache/struts/taglib/html/TestMultiboxTag4.jsp");
97     }
98
99     /*
100      * Testing MultiboxTag.
101      */

102     public void testMultiboxBodyPropertyFalse() throws Exception JavaDoc {
103         runMyTest("testMultiboxBodyPropertyFalse", "");
104         }
105     public void testMultiboxBodyPropertyFalseAccesskey() throws Exception JavaDoc {
106         runMyTest("testMultiboxBodyPropertyFalseAccesskey", "");
107         }
108     public void testMultiboxBodyPropertyFalseAlt() throws Exception JavaDoc {
109         runMyTest("testMultiboxBodyPropertyFalseAlt", "");
110         }
111     public void testMultiboxBodyPropertyFalseAltKey1() throws Exception JavaDoc {
112         runMyTest("testMultiboxBodyPropertyFalseAltKey1", "");
113         }
114     public void testMultiboxBodyPropertyFalseAltKey2() throws Exception JavaDoc {
115         runMyTest("testMultiboxBodyPropertyFalseAltKey2", "");
116         }
117     public void testMultiboxBodyPropertyFalseAltKey_fr1() throws Exception JavaDoc {
118         runMyTest("testMultiboxBodyPropertyFalseAltKey1_fr", "fr");
119         }
120     public void testMultiboxBodyPropertyFalseAltKey_fr2() throws Exception JavaDoc {
121         runMyTest("testMultiboxBodyPropertyFalseAltKey2_fr", "fr");
122         }
123     public void testMultiboxBodyPropertyFalseDisabled_False() throws Exception JavaDoc {
124         runMyTest("testMultiboxBodyPropertyFalseDisabled_True", "");
125         }
126     public void testMultiboxBodyPropertyFalseDisabled_False1() throws Exception JavaDoc {
127         runMyTest("testMultiboxBodyPropertyFalseDisabled_False1", "");
128         }
129     public void testMultiboxBodyPropertyFalseDisabled_False2() throws Exception JavaDoc {
130         runMyTest("testMultiboxBodyPropertyFalseDisabled_False2", "");
131         }
132     public void testMultiboxBodyPropertyFalseOnblur() throws Exception JavaDoc {
133         runMyTest("testMultiboxBodyPropertyFalseOnblur", "");
134         }
135
136     public void testMultiboxBodyPropertyFalseOnchange() throws Exception JavaDoc {
137         runMyTest("testMultiboxBodyPropertyFalseOnchange", "");
138         }
139
140     public void testMultiboxBodyPropertyFalseOnclick() throws Exception JavaDoc {
141         runMyTest("testMultiboxBodyPropertyFalseOnclick", "");
142         }
143
144     public void testMultiboxBodyPropertyFalseOndblclick() throws Exception JavaDoc {
145         runMyTest("testMultiboxBodyPropertyFalseOndblclick", "");
146         }
147
148     public void testMultiboxBodyPropertyFalseOnfocus() throws Exception JavaDoc {
149         runMyTest("testMultiboxBodyPropertyFalseOnfocus", "");
150         }
151
152     public void testMultiboxBodyPropertyFalseOnkeydown() throws Exception JavaDoc {
153         runMyTest("testMultiboxBodyPropertyFalseOnkeydown", "");
154         }
155
156     public void testMultiboxBodyPropertyFalseOnkeypress() throws Exception JavaDoc {
157         runMyTest("testMultiboxBodyPropertyFalseOnkeypress", "");
158         }
159
160     public void testMultiboxBodyPropertyFalseOnkeyup() throws Exception JavaDoc {
161         runMyTest("testMultiboxBodyPropertyFalseOnkeyup", "");
162         }
163
164     public void testMultiboxBodyPropertyFalseOnmousedown() throws Exception JavaDoc {
165         runMyTest("testMultiboxBodyPropertyFalseOnmousedown", "");
166         }
167
168     public void testMultiboxBodyPropertyFalseOnmousemove() throws Exception JavaDoc {
169         runMyTest("testMultiboxBodyPropertyFalseOnmousemove", "");
170         }
171
172     public void testMultiboxBodyPropertyFalseOnmouseout() throws Exception JavaDoc {
173         runMyTest("testMultiboxBodyPropertyFalseOnmouseout", "");
174         }
175
176     public void testMultiboxBodyPropertyFalseOnmouseover() throws Exception JavaDoc {
177         runMyTest("testMultiboxBodyPropertyFalseOnmouseover", "");
178         }
179
180     public void testMultiboxBodyPropertyFalseOnmouseup() throws Exception JavaDoc {
181         runMyTest("testMultiboxBodyPropertyFalseOnmouseup", "");
182         }
183
184 }
185
Popular Tags