KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TestErrorsTag3.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 TestErrorsTag3 extends JspTestCase {
36
37     /**
38      * Defines the testcase name for JUnit.
39      *
40      * @param theName the testcase's name.
41      */

42     public TestErrorsTag3(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[] {TestErrorsTag3.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(TestErrorsTag3.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/TestErrorsTag3.jsp");
68     }
69
70     /*
71      * Testing ErrorsTag.
72      */

73     public void testErrorsDefaultBundle0ErrorsName() throws Exception JavaDoc {
74         runMyTest("testErrorsDefaultBundle0ErrorsName", "");
75         }
76     public void testErrorsDefaultBundle2ErrorsName() throws Exception JavaDoc {
77         runMyTest("testErrorsDefaultBundle2ErrorsName", "");
78         }
79
80     public void testErrorsAlternateBundle0ErrorsName() throws Exception JavaDoc {
81         runMyTest("testErrorsAlternateBundle0ErrorsName", "");
82         }
83     public void testErrorsAlternateBundle2ErrorsName() throws Exception JavaDoc {
84         runMyTest("testErrorsAlternateBundle2ErrorsName", "");
85         }
86
87     public void testErrorsDefaultBundle0ErrorsName_fr() throws Exception JavaDoc {
88         runMyTest("testErrorsDefaultBundle0ErrorsName_fr", "fr");
89         }
90     public void testErrorsDefaultBundle2ErrorsName_fr() throws Exception JavaDoc {
91         runMyTest("testErrorsDefaultBundle2ErrorsName_fr", "fr");
92         }
93
94     public void testErrorsAlternateBundle0ErrorsName_fr() throws Exception JavaDoc {
95         runMyTest("testErrorsAlternateBundle0ErrorsName_fr", "fr");
96         }
97     public void testErrorsAlternateBundle2ErrorsName_fr() throws Exception JavaDoc {
98         runMyTest("testErrorsAlternateBundle2ErrorsName_fr", "fr");
99         }
100
101
102
103     public void testErrorsDefaultBundle0ErrorsLocaleName() throws Exception JavaDoc {
104         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
105         runMyTest("testErrorsDefaultBundle0ErrorsLocaleName", "");
106         }
107     public void testErrorsDefaultBundle2ErrorsLocaleName() throws Exception JavaDoc {
108         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
109         runMyTest("testErrorsDefaultBundle2ErrorsLocaleName", "");
110         }
111
112     public void testErrorsAlternateBundle0ErrorsLocaleName() throws Exception JavaDoc {
113         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
114         runMyTest("testErrorsAlternateBundle0ErrorsLocaleName", "");
115         }
116     public void testErrorsAlternateBundle2ErrorsLocaleName() throws Exception JavaDoc {
117         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
118         runMyTest("testErrorsAlternateBundle2ErrorsLocaleName", "");
119         }
120
121     public void testErrorsDefaultBundle0ErrorsLocaleName_fr() throws Exception JavaDoc {
122         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
123         runMyTest("testErrorsDefaultBundle0ErrorsLocaleName_fr", "");
124         }
125     public void testErrorsDefaultBundle2ErrorsLocaleName_fr() throws Exception JavaDoc {
126         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
127         runMyTest("testErrorsDefaultBundle2ErrorsLocaleName_fr", "");
128         }
129
130     public void testErrorsAlternateBundle0ErrorsLocaleName_fr() throws Exception JavaDoc {
131         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
132         runMyTest("testErrorsAlternateBundle0ErrorsLocaleName_fr", "");
133         }
134     public void testErrorsAlternateBundle2ErrorsLocaleName_fr() throws Exception JavaDoc {
135         pageContext.setAttribute("MY_LOCALE_KEY", new Locale JavaDoc("fr", "fr"), PageContext.SESSION_SCOPE);
136         runMyTest("testErrorsAlternateBundle2ErrorsLocaleName_fr", "");
137         }
138
139
140 }
141
Popular Tags