1 16 package org.apache.jetspeed.services.customlocalization; 17 18 import junit.framework.Test; 20 import junit.framework.TestSuite; 21 22 import java.util.Locale ; 24 25 import org.apache.jetspeed.services.customlocalization.CustomLocalization; 26 import org.apache.jetspeed.test.HeadlessBaseTest; 27 28 34 35 public class TestLocalization extends HeadlessBaseTest 36 { 37 42 public TestLocalization(String name) 43 { 44 super(name); 45 } 46 47 52 public static void main(String args[]) 53 { 54 junit.awtui.TestRunner.main(new String [] {TestLocalization.class.getName()}); 55 } 56 57 59 public void setup() 60 { 61 System.out.println("Setup: Testing Localization"); 62 } 63 64 68 public static Test suite() 69 { 70 return new TestSuite(TestLocalization.class); 72 } 73 74 75 77 public void testGoodTranslation() throws Exception 78 { 79 Locale locale = null; 80 String test = null; 81 82 locale = new Locale ("en", "US"); 84 test = CustomLocalization.getString(null, locale, "LOGIN_USERNAME"); 85 System.out.println("Locale [en-US]: LOGIN_USER translation = " + test); 86 87 assertTrue(test.equals("Username:")); 88 89 locale = new Locale ("pl", ""); 91 test = CustomLocalization.getString(null, locale, "LOGIN_TITLE"); 92 System.out.println("Locale [pl]: LOGIN_TITLE translation = " + test); 93 94 assertTrue(test.equals("Logowanie")); 95 96 locale = new Locale ("my", ""); 98 test = CustomLocalization.getString(null, locale, "_TEST_"); 99 System.out.println("Locale [my]: _TEST_ = " + test); 100 101 assertTrue(test.equals("Do not translate")); 102 103 } 104 105 } 106 107 108 109 | Popular Tags |