ICU-12431 Update test expectations in TestLocaleNamePackaging.

These test expectations have been out-of-sync with the output that ICU4J
actually generates for quite some time now. This change brings the
expectations in sync with actual behaviour and makes the test pass.
This commit is contained in:
Fredrik Roubert 2019-03-18 21:33:52 +01:00 committed by Fredrik Roubert
parent 633b6510c4
commit 78a4abc5ed

View File

@ -68,10 +68,10 @@ public class TestLocaleNamePackaging extends TestFmwk {
"Deutschland",
"Thailand",
"",
"United States",
"Spain",
"Germany",
"Thailand",
"US",
"ES",
"DE",
"TH",
};
String[] expectedWithoutRegionData = {
"",
@ -117,34 +117,34 @@ public class TestLocaleNamePackaging extends TestFmwk {
"en",
"es",
"de",
"und",
"",
"",
"English",
"Spanish",
"German",
"Unknown Language",
"",
"",
"ingl\u00E9s",
"espa\u00F1ol",
"alem\u00E1n",
"lengua desconocida",
"",
"",
"Englisch",
"Spanisch",
"Deutsch",
"Unbestimmte Sprache",
"",
"English",
"Spanish",
"German",
"Unknown Language",
"",
"en",
"es",
"de",
"",
};
String[] expectedWithoutLanguageData = {
"",
"en",
"es",
"de",
"und"
"",
};
String[] expected = LocaleDisplayNamesImpl.haveData(LANG) ?
expectedWithLanguageData : expectedWithoutLanguageData;
@ -166,9 +166,12 @@ public class TestLocaleNamePackaging extends TestFmwk {
for (Locale displayJavaLocale : javaLocales) {
LocaleDisplayNames dn = LocaleDisplayNames.getInstance(displayJavaLocale);
for (Locale targetLocale : javaLocales) {
String result = dn.languageDisplayName(targetLocale.getLanguage());
assertEquals(targetLocale + " in " + displayJavaLocale, expected[n++], result);
if (n == expected.length) {
// ICU-20273: ICU and Java handle "und" differently, skip those test cases.
if (!"und".equals(targetLocale.getLanguage())) {
String result = dn.languageDisplayName(targetLocale.getLanguage());
assertEquals(targetLocale + " in " + displayJavaLocale, expected[n], result);
}
if (++n == expected.length) {
n = 0;
}
}
@ -180,14 +183,14 @@ public class TestLocaleNamePackaging extends TestFmwk {
@Test
public void testLocaleDisplayNameWithKeywords() {
String[] expectedWithLanguageData = {
"root (collation=phonebook)",
"Root (Phonebook Sort Order)",
"ra\u00EDz (orden de list\u00EDn telef\u00F3nico)",
"Root (Telefonbuch-Sortierung)",
"Root (Phonebook Sort Order)",
"und (collation=phonebook)",
"Unknown language (Phonebook Sort Order)",
"lengua desconocida (orden de list\u00EDn telef\u00F3nico)",
"Unbekannte Sprache (Telefonbuch-Sortierung)",
"und (collation=phonebook)",
};
String[] expectedWithoutLanguageData = {
"root (collation=phonebook)",
"und (collation=phonebook)",
};
String[] expected = LocaleDisplayNamesImpl.haveData(LANG) ?
expectedWithLanguageData : expectedWithoutLanguageData;