KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TestErrorsTag2.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
24 import junit.framework.Test;
25 import junit.framework.TestSuite;
26
27 import org.apache.cactus.JspTestCase;
28 import org.apache.struts.Globals;
29
30 /**
31  * Suite of unit tests for the
32  * <code>org.apache.struts.taglib.html.ErrorsTag</code> class.
33  *
34  */

35 public class TestErrorsTag2 extends JspTestCase {
36
37     /**
38      * Defines the testcase name for JUnit.
39      *
40      * @param theName the testcase's name.
41      */

42     public TestErrorsTag2(String JavaDoc theName) {
43         super(theName);
44     }
45
46     /**
47      * Start the tests.
48      *
49      * @param theArgs the arguments. Not used
50      */

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

59     public static Test suite() {
60         // All methods starting with "test" will be executed in the test suite.
61
return new TestSuite(TestErrorsTag2.class);
62     }
63
64     private void runMyTest(String JavaDoc whichTest, String JavaDoc locale) throws Exception JavaDoc {
65         request.setAttribute("runTest", whichTest);
66         pageContext.setAttribute(Globals.LOCALE_KEY, new Locale JavaDoc(locale, locale), PageContext.SESSION_SCOPE);
67         pageContext.forward("/test/org/apache/struts/taglib/html/TestErrorsTag2.jsp");
68     }
69
70
71     /*
72      * Testing ErrorsTag.
73      */

74
75     public void testErrorsDefaultBundle0ErrorsProperty() throws Exception JavaDoc {
76         runMyTest("testErrorsDefaultBundle0ErrorsProperty", "");
77         }
78     public void testErrorsDefaultBundle2ErrorsProperty() throws Exception JavaDoc {
79         runMyTest("testErrorsDefaultBundle2ErrorsProperty", "");
80         }
81
82     public void testErrorsAlternateBundle0ErrorsProperty() throws Exception JavaDoc {
83         runMyTest("testErrorsAlternateBundle0ErrorsProperty", "");
84         }
85     public void testErrorsAlternateBundle2ErrorsProperty() throws Exception JavaDoc {
86         runMyTest("testErrorsAlternateBundle2ErrorsProperty", "");
87         }
88
89     public void testErrorsDefaultBundle0ErrorsProperty_fr() throws Exception JavaDoc {
90         runMyTest("testErrorsDefaultBundle0ErrorsProperty_fr", "fr");
91         }
92     public void testErrorsDefaultBundle2ErrorsProperty_fr() throws Exception JavaDoc {
93         runMyTest("testErrorsDefaultBundle2ErrorsProperty_fr", "fr");
94         }
95
96     public void testErrorsAlternateBundle0ErrorsProperty_fr() throws Exception JavaDoc {
97         runMyTest("testErrorsAlternateBundle0ErrorsProperty_fr", "fr");
98         }
99     public void testErrorsAlternateBundle2ErrorsProperty_fr() throws Exception JavaDoc {
100         runMyTest("testErrorsAlternateBundle2ErrorsProperty_fr", "fr");
101         }
102
103
104
105     public void testErrorsDefaultBundle0ErrorsLocaleProperty() throws Exception JavaDoc {
106         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
107         runMyTest("testErrorsDefaultBundle0ErrorsLocaleProperty", "");
108         }
109     public void testErrorsDefaultBundle2ErrorsLocaleProperty() throws Exception JavaDoc {
110         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
111         runMyTest("testErrorsDefaultBundle2ErrorsLocaleProperty", "");
112         }
113
114     public void testErrorsAlternateBundle0ErrorsLocaleProperty() throws Exception JavaDoc {
115         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
116         runMyTest("testErrorsAlternateBundle0ErrorsLocaleProperty", "");
117         }
118     public void testErrorsAlternateBundle2ErrorsLocaleProperty() throws Exception JavaDoc {
119         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
120         runMyTest("testErrorsAlternateBundle2ErrorsLocaleProperty", "");
121         }
122
123     public void testErrorsDefaultBundle0ErrorsLocaleProperty_fr() throws Exception JavaDoc {
124         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
125         runMyTest("testErrorsDefaultBundle0ErrorsLocaleProperty_fr", "");
126         }
127     public void testErrorsDefaultBundle2ErrorsLocaleProperty_fr() throws Exception JavaDoc {
128         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
129         runMyTest("testErrorsDefaultBundle2ErrorsLocaleProperty_fr", "");
130         }
131
132     public void testErrorsAlternateBundle0ErrorsLocaleProperty_fr() throws Exception JavaDoc {
133         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
134         runMyTest("testErrorsAlternateBundle0ErrorsLocaleProperty_fr", "");
135         }
136     public void testErrorsAlternateBundle2ErrorsLocaleProperty_fr() throws Exception JavaDoc {
137         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
138         runMyTest("testErrorsAlternateBundle2ErrorsLocaleProperty_fr", "");
139         }
140
141 }
142
Popular Tags