aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2016-07-07 02:09:25 +0000
committerJaven O'Neal <onealj@apache.org>2016-07-07 02:09:25 +0000
commitac8a6ef081cee45b5eadeb9e86f53fb62809b830 (patch)
tree275111967ea9aa9151313bd7214edb0431c517de /src/testcases/org
parent2365d88bd4d12c60d08cfb4193466961045c571d (diff)
downloadpoi-ac8a6ef081cee45b5eadeb9e86f53fb62809b830.tar.gz
poi-ac8a6ef081cee45b5eadeb9e86f53fb62809b830.zip
bug 59805: tearDown should reset, not set, the LocaleUtil ThreadLocals (also avoid memory leaks)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751741 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
-rw-r--r--src/testcases/org/apache/poi/util/TestLocaleUtil.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/testcases/org/apache/poi/util/TestLocaleUtil.java b/src/testcases/org/apache/poi/util/TestLocaleUtil.java
index 7aeabd146d..3a7c65a6a7 100644
--- a/src/testcases/org/apache/poi/util/TestLocaleUtil.java
+++ b/src/testcases/org/apache/poi/util/TestLocaleUtil.java
@@ -40,16 +40,12 @@ public class TestLocaleUtil {
/**
* Reset the Locale to the user default before the test so that it isn't influenced
* by the LocaleUtil's state being changed by previous tests.
- *
- * Reset the Locale to the user default after the test so that it doesn't influence
- * other tests.
*/
@Before
- @After
@SuppressForbidden("implementation around default locales in POI")
- public void reset() {
- // clear the user locale and time zone so that tests do not interfere with each other
- // the other way and better way would be to run each test in its own thread since
+ public void setUp() {
+ // reset the user locale and time zone so that tests do not interfere with each other
+ // the other and better way would be to run each test in its own thread since
// LocaleUtil uses per-thread settings.
// Helpful, but not ASL 2.0 licensed:
// http://www.codeaffine.com/2014/07/21/a-junit-rule-to-run-a-test-in-its-own-thread/
@@ -59,6 +55,16 @@ public class TestLocaleUtil {
assumeFalse(ja_JP.equals(LocaleUtil.getUserLocale()));
assumeFalse(TOKYO.equals(LocaleUtil.getUserTimeZone()));
}
+
+ /**
+ * Reset the Locale to the user default after the test so that it doesn't influence
+ * other tests.
+ */
+ @After
+ public void tearDown() {
+ LocaleUtil.resetUserLocale();
+ LocaleUtil.resetUserTimeZone();
+ }
@Test
@SuppressForbidden("implementation around default locales in POI")