test/java/util/Locale/LocaleProviders.java
Print this page
rev 7043 : imported patch 8013086
rev 7044 : imported patch 8013233
*** 122,144 ****
System.out.printf("Windows version: %.1f\n", ver);
if (ver >= 6.0) {
LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(LocaleNameProvider.class, Locale.ENGLISH);
LocaleProviderAdapter.Type type = lda.getAdapterType();
if (type == LocaleProviderAdapter.Type.HOST) {
Locale mkmk = Locale.forLanguageTag("mk-MK");
String result = mkmk.getDisplayLanguage(Locale.ENGLISH);
! if (!"Macedonian (FYROM)".equals(result)) {
! throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"mk\". Returned name was \"" + result + "\"");
}
result = Locale.US.getDisplayLanguage(Locale.ENGLISH);
! if (!"English".equals(result)) {
! throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"en\". Returned name was \"" + result + "\"");
}
result = Locale.US.getDisplayCountry(Locale.ENGLISH);
! if (ver >= 6.1 && !"United States".equals(result)) {
! throw new RuntimeException("Windows locale name provider did not return expected localized country name for \"US\". Returned name was \"" + result + "\"");
}
} else {
throw new RuntimeException("Windows Host LocaleProviderAdapter was not selected for English locale.");
}
}
} catch (ParseException pe) {
--- 122,159 ----
System.out.printf("Windows version: %.1f\n", ver);
if (ver >= 6.0) {
LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(LocaleNameProvider.class, Locale.ENGLISH);
LocaleProviderAdapter.Type type = lda.getAdapterType();
if (type == LocaleProviderAdapter.Type.HOST) {
+ LocaleNameProvider lnp = lda.getLocaleNameProvider();
Locale mkmk = Locale.forLanguageTag("mk-MK");
String result = mkmk.getDisplayLanguage(Locale.ENGLISH);
! String expected = lnp.getDisplayLanguage(mkmk.getLanguage(), Locale.ENGLISH);
! System.out.printf(" Display language name for (mk_MK): expected: \"%s\", returned: \"%s\"\n", expected, result);
! if (result != null &&
! expected != null &&
! !result.equals(expected)) {
! throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"mk\". Returned name was \"" + result + "\", expected: \"" + expected + "\"");
}
result = Locale.US.getDisplayLanguage(Locale.ENGLISH);
! expected = lnp.getDisplayLanguage(Locale.US.getLanguage(), Locale.ENGLISH);
! System.out.printf(" Display language name for (en_US): expected: \"%s\", returned: \"%s\"\n", expected, result);
! if (result != null &&
! expected != null &&
! !result.equals(expected)) {
! throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"en\". Returned name was \"" + result + "\", expected: \"" + expected + "\"");
}
+ if (ver >= 6.1) {
result = Locale.US.getDisplayCountry(Locale.ENGLISH);
! expected = lnp.getDisplayCountry(Locale.US.getCountry(), Locale.ENGLISH);
! System.out.printf(" Display country name for (en_US): expected: \"%s\", returned: \"%s\"\n", expected, result);
! if (result != null &&
! expected != null &&
! !result.equals(expected)) {
! throw new RuntimeException("Windows locale name provider did not return expected localized country name for \"US\". Returned name was \"" + result + "\", expected: \"" + expected + "\"");
}
+ }
} else {
throw new RuntimeException("Windows Host LocaleProviderAdapter was not selected for English locale.");
}
}
} catch (ParseException pe) {