43 case "adapterTest":
44 adapterTest(args[1], args[2], (args.length >= 4 ? args[3] : ""));
45 break;
46
47 case "bug7198834Test":
48 bug7198834Test();
49 break;
50
51 case "tzNameTest":
52 tzNameTest(args[1]);
53 break;
54
55 case "bug8001440Test":
56 bug8001440Test();
57 break;
58
59 case "bug8010666Test":
60 bug8010666Test();
61 break;
62
63 default:
64 throw new RuntimeException("Test method '"+methodName+"' not found.");
65 }
66 }
67
68 static void getPlatformLocale(Locale.Category cat) {
69 Locale defloc = Locale.getDefault(cat);
70 System.out.printf("%s,%s\n", defloc.getLanguage(), defloc.getCountry());
71 }
72
73 static void adapterTest(String expected, String lang, String ctry) {
74 Locale testLocale = new Locale(lang, ctry);
75 String preference = System.getProperty("java.locale.providers", "");
76 LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, testLocale);
77 LocaleProviderAdapter.Type type = lda.getAdapterType();
78 System.out.printf("testLocale: %s, got: %s, expected: %s\n", testLocale, type, expected);
79 if (!type.toString().equals(expected)) {
80 throw new RuntimeException("Returned locale data adapter is not correct.");
81 }
82 }
125 if (!"Macedonian (FYROM)".equals(result)) {
126 throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"mk\". Returned name was \"" + result + "\"");
127 }
128 result = Locale.US.getDisplayLanguage(Locale.ENGLISH);
129 if (!"English".equals(result)) {
130 throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"en\". Returned name was \"" + result + "\"");
131 }
132 result = Locale.US.getDisplayCountry(Locale.ENGLISH);
133 if (ver >= 6.1 && !"United States".equals(result)) {
134 throw new RuntimeException("Windows locale name provider did not return expected localized country name for \"US\". Returned name was \"" + result + "\"");
135 }
136 } else {
137 throw new RuntimeException("Windows Host LocaleProviderAdapter was not selected for English locale.");
138 }
139 }
140 } catch (ParseException pe) {
141 throw new RuntimeException("Parsing Windows version failed: "+pe.toString());
142 }
143 }
144 }
145 }
|
43 case "adapterTest":
44 adapterTest(args[1], args[2], (args.length >= 4 ? args[3] : ""));
45 break;
46
47 case "bug7198834Test":
48 bug7198834Test();
49 break;
50
51 case "tzNameTest":
52 tzNameTest(args[1]);
53 break;
54
55 case "bug8001440Test":
56 bug8001440Test();
57 break;
58
59 case "bug8010666Test":
60 bug8010666Test();
61 break;
62
63 case "bug8013086Test":
64 bug8013086Test(args[1], args[2]);
65 break;
66
67 default:
68 throw new RuntimeException("Test method '"+methodName+"' not found.");
69 }
70 }
71
72 static void getPlatformLocale(Locale.Category cat) {
73 Locale defloc = Locale.getDefault(cat);
74 System.out.printf("%s,%s\n", defloc.getLanguage(), defloc.getCountry());
75 }
76
77 static void adapterTest(String expected, String lang, String ctry) {
78 Locale testLocale = new Locale(lang, ctry);
79 String preference = System.getProperty("java.locale.providers", "");
80 LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, testLocale);
81 LocaleProviderAdapter.Type type = lda.getAdapterType();
82 System.out.printf("testLocale: %s, got: %s, expected: %s\n", testLocale, type, expected);
83 if (!type.toString().equals(expected)) {
84 throw new RuntimeException("Returned locale data adapter is not correct.");
85 }
86 }
129 if (!"Macedonian (FYROM)".equals(result)) {
130 throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"mk\". Returned name was \"" + result + "\"");
131 }
132 result = Locale.US.getDisplayLanguage(Locale.ENGLISH);
133 if (!"English".equals(result)) {
134 throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"en\". Returned name was \"" + result + "\"");
135 }
136 result = Locale.US.getDisplayCountry(Locale.ENGLISH);
137 if (ver >= 6.1 && !"United States".equals(result)) {
138 throw new RuntimeException("Windows locale name provider did not return expected localized country name for \"US\". Returned name was \"" + result + "\"");
139 }
140 } else {
141 throw new RuntimeException("Windows Host LocaleProviderAdapter was not selected for English locale.");
142 }
143 }
144 } catch (ParseException pe) {
145 throw new RuntimeException("Parsing Windows version failed: "+pe.toString());
146 }
147 }
148 }
149
150 static void bug8013086Test(String lang, String ctry) {
151 try {
152 // Throws a NullPointerException if the test fails.
153 System.out.println(new SimpleDateFormat("z", new Locale(lang, ctry)).parse("UTC"));
154 } catch (ParseException pe) {
155 // ParseException is fine in this test, as it's not "UTC"
156 }
157 }
158 }
|