]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/tests/core/src/com/ibm/icu/dev/test/util/TestDefaultPackageLoading.jpp
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / tests / core / src / com / ibm / icu / dev / test / util / TestDefaultPackageLoading.jpp
1 /*\r
2  *******************************************************************************\r
3  * Copyright (C) 2005, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 import java.util.MissingResourceException;\r
8 \r
9 import com.ibm.icu.dev.test.TestFmwk;\r
10 import com.ibm.icu.util.UResourceBundle;\r
11 /*\r
12  * Eclipse expects the java files in a package-like directory structure to have a package declaration at the top of the file.\r
13  * To fool Eclipse this file has an "jpp" extension. The ant build script copies this file to the default package and renames it\r
14  * before building.\r
15  */ \r
16 /**\r
17  * @author ram\r
18  */\r
19 public class TestDefaultPackageLoading extends TestFmwk{\r
20     public static void main(String[] args){\r
21         new TestDefaultPackageLoading().run(args);\r
22     }\r
23     public void TestResourceBundleLoading(){\r
24         try{\r
25             UResourceBundle bundle = UResourceBundle.getBundleInstance("TestData", "en");\r
26             String aaa = bundle.getString("aaa");\r
27             if(!aaa.equals("testcircularalias/aab")){\r
28                 errln("Did not get the expected data");\r
29             }\r
30         }catch (MissingResourceException ex){\r
31             errln("could not load data "+ex.getMessage());\r
32         }\r
33     }\r
34     public void TestResFileLoading(){\r
35         try{\r
36             UResourceBundle bundle = UResourceBundle.getBundleInstance("", "te");\r
37             String aaa = bundle.getString("string_only_in_te");\r
38             if(!aaa.equals("TE")){\r
39                 errln("Did not get the expected data");\r
40             }\r
41         }catch (MissingResourceException ex){\r
42             errln("could not load data "+ex.getMessage());\r
43         }\r
44     }\r
45     public void TestJB3767(){\r
46         try{\r
47             UResourceBundle bundle = UResourceBundle.getBundleInstance("com.ibm.icu.dev.data.TestData", "bge");\r
48             String aaa = bundle.getString("string_only_in_te");\r
49             if(!aaa.equals("TE")){\r
50                 errln("Did not get the expected data");\r
51             }\r
52             logln("Got : " + bundle.getULocale().getName());\r
53         }catch (MissingResourceException ex){\r
54             errln("could not load data "+ex.getMessage());\r
55         }\r
56     }\r
57     \r
58 }\r