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 { 10 super.setUp(); 11 } 12 13 public void testGetLocalizedMessageString() { 14 InternalResources intres = InternalResourcesTestClass.getInstance(); 15 String res = intres.getLocalizedMessage("raadmin.testmsg"); 16 assertEquals("Test ENG", res); 17 res = intres.getLocalizedMessage("raadmin.testmsgsv"); 19 assertEquals("Test SV", res); 20 } 21 22 public void testNonExistingLocalizedMessageString() { 23 InternalResources intres = InternalResourcesTestClass.getInstance(); 24 25 String res = intres.getLocalizedMessage("raadmin.foo"); 26 assertEquals("No text available", res); 27 } 28 29 public void testGetLocalizedMessageStringObject() { 30 InternalResources intres = InternalResourcesTestClass.getInstance(); 31 String res = intres.getLocalizedMessage("raadmin.testparams",new Long (1), new Integer (3), "hi", new Boolean (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 res = intres.getLocalizedMessage("raadmin.testparams",null, new Integer (3), null, new Boolean (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 |