KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > TestInternalResources


1 package org.ejbca.core.model;
2
3 import junit.framework.TestCase;
4
5 public class TestInternalResources extends TestCase {
6
7     
8
9     protected void setUp() throws Exception JavaDoc {
10         super.setUp();
11     }
12
13     public void testGetLocalizedMessageString() {
14         InternalResources intres = InternalResourcesTestClass.getInstance();
15         String JavaDoc res = intres.getLocalizedMessage("raadmin.testmsg");
16         assertEquals("Test ENG", res);
17         // This message will only exist in the secondary language file
18
res = intres.getLocalizedMessage("raadmin.testmsgsv");
19         assertEquals("Test SV", res);
20     }
21     
22     public void testNonExistingLocalizedMessageString() {
23         InternalResources intres = InternalResourcesTestClass.getInstance();
24         
25         String JavaDoc res = intres.getLocalizedMessage("raadmin.foo");
26         assertEquals("No text available", res);
27     }
28
29     public void testGetLocalizedMessageStringObject() {
30         InternalResources intres = InternalResourcesTestClass.getInstance();
31         String JavaDoc res = intres.getLocalizedMessage("raadmin.testparams",new Long JavaDoc(1), new Integer JavaDoc(3), "hi", new Boolean JavaDoc(true), "bye");
32         assertEquals("Test 1 3 hi true bye message 1", res);
33     }
34
35     public void testGetLocalizedMessageStringObjectWithNull() {
36         InternalResources intres = InternalResourcesTestClass.getInstance();
37         
38         String JavaDoc res = intres.getLocalizedMessage("raadmin.testparams",null, new Integer JavaDoc(3), null, new Boolean JavaDoc(true), "bye");
39         assertEquals("Test 3 true bye message ", res);
40
41         res = intres.getLocalizedMessage("raadmin.testparams");
42         assertEquals("Test message ", res);
43     }
44 }
45
Popular Tags