mirror of
https://github.com/stleary/JSON-java.git
synced 2026-01-24 00:03:17 -05:00
Merge pull request #1027 from Simulant87/1023-set-default-locale
Save/restore default locale in test
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user