Merge pull request #1027 from Simulant87/1023-set-default-locale

Save/restore default locale in test
This commit is contained in:
Sean Leary
2025-12-29 19:42:57 -06:00
committed by GitHub

View File

@@ -36,6 +36,9 @@ public class JSONObjectLocaleTest {
MyLocaleBean myLocaleBean = new MyLocaleBean(); MyLocaleBean myLocaleBean = new MyLocaleBean();
// save and restore the current default locale, to avoid any side effects on other executions in the same JVM
Locale defaultLocale = Locale.getDefault();
try {
/** /**
* This is just the control case which happens when the locale.ROOT * This is just the control case which happens when the locale.ROOT
* lowercasing behavior is the same as the current locale. * lowercasing behavior is the same as the current locale.
@@ -56,5 +59,8 @@ public class JSONObjectLocaleTest {
assertEquals("expected size 2, found: " +jsontr.length(), 2, jsontr.length()); assertEquals("expected size 2, found: " +jsontr.length(), 2, jsontr.length());
assertEquals("expected jsontr[i] == beanI", "beanI", jsontr.getString("i")); assertEquals("expected jsontr[i] == beanI", "beanI", jsontr.getString("i"));
assertEquals("expected jsontr[id] == beanId", "beanId", jsontr.getString("id")); assertEquals("expected jsontr[id] == beanId", "beanId", jsontr.getString("id"));
} finally {
Locale.setDefault(defaultLocale);
}
} }
} }