Fix bug in test.

This commit is contained in:
Gary Gregory 2020-06-22 09:28:58 -04:00
parent b7b4ae33dc
commit 64b2f90d20
1 changed files with 12 additions and 7 deletions

View File

@ -244,16 +244,21 @@ public void testContainsIgnoreCase_LocaleIndependence() {
{ "\u00DF", "SS" }, { "\u00DF", "SS" },
}; };
for (final Locale testLocale : locales) { final Locale defaultLocale = Locale.getDefault();
Locale.setDefault(testLocale); try {
for (int j = 0; j < tdata.length; j++) { for (final Locale testLocale : locales) {
assertTrue(StringUtils.containsIgnoreCase(tdata[j][0], tdata[j][1]), Locale.setDefault(testLocale);
for (int j = 0; j < tdata.length; j++) {
assertTrue(StringUtils.containsIgnoreCase(tdata[j][0], tdata[j][1]),
Locale.getDefault() + ": " + j + " " + tdata[j][0] + " " + tdata[j][1]); Locale.getDefault() + ": " + j + " " + tdata[j][0] + " " + tdata[j][1]);
} }
for (int j = 0; j < fdata.length; j++) { for (int j = 0; j < fdata.length; j++) {
assertFalse(StringUtils.containsIgnoreCase(fdata[j][0], fdata[j][1]), assertFalse(StringUtils.containsIgnoreCase(fdata[j][0], fdata[j][1]),
Locale.getDefault() + ": " + j + " " + fdata[j][0] + " " + fdata[j][1]); Locale.getDefault() + ": " + j + " " + fdata[j][0] + " " + fdata[j][1]);
}
} }
} finally {
Locale.setDefault(defaultLocale);
} }
} }