2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shale.util;
19
20 import java.util.Locale;
21 import java.util.Map;
22
23 import javax.faces.context.FacesContext;
24
25 import junit.framework.Test;
26 import junit.framework.TestSuite;
27
28 import org.apache.shale.test.base.AbstractJsfTestCase;
29
30 /***
31 * <p>Test case for <code>LoadBundle</code>.</p>
32 */
33 public class LoadBundleTestCase extends AbstractJsfTestCase {
34
35
36
37
38
39
40 public LoadBundleTestCase(String name) {
41 super(name);
42 }
43
44
45
46
47
48
49 protected void setUp() throws Exception {
50
51 super.setUp();
52
53
54 lb = new LoadBundle("org.apache.shale.util.TestBundle");
55
56 }
57
58
59
60 public static Test suite() {
61
62 return (new TestSuite(LoadBundleTestCase.class));
63
64 }
65
66
67
68 protected void tearDown() throws Exception {
69
70 lb = null;
71 super.tearDown();
72
73 }
74
75
76
77
78
79
80 LoadBundle lb = null;
81
82
83
84
85
86
87 public void testEngish() {
88
89 FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale("en", "US"));
90 Map map = lb.getMap();
91 assertNotNull(map);
92 assertEquals("English Key 1", map.get("key1"));
93 assertEquals("English Key 2", map.get("key2"));
94
95 }
96
97
98
99 public void testFrench() {
100
101 FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale("fr", "FR"));
102 Map map = lb.getMap();
103 assertNotNull(map);
104 assertEquals("French Key 1", map.get("key1"));
105 assertEquals("French Key 2", map.get("key2"));
106
107 }
108
109
110
111 public void testPristine() {
112
113 assertEquals("org.apache.shale.util.TestBundle", lb.getBasename());
114
115 }
116
117
118 }