diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-10-23 22:30:33 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-10-23 22:30:33 +0000 |
commit | d708b9da00cb25b169f6f2bc43d44a00e520090f (patch) | |
tree | 335265aad694ad2abdec66737ca338670286eed9 /src/testcases/org/apache/poi | |
parent | a2dcb10f67c816acd1ab9ed779dae12ad7536603 (diff) | |
download | poi-d708b9da00cb25b169f6f2bc43d44a00e520090f.tar.gz poi-d708b9da00cb25b169f6f2bc43d44a00e520090f.zip |
try to fix sonar build
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1882792 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java | 2 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java | 39 |
2 files changed, 25 insertions, 16 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 446d9b1d0e..129a74fd96 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -134,6 +134,8 @@ public final class TestBugs extends BaseTestBugzillaIssues { } SIMPLE_REFS.put(fileName, wb.getCreationHelper().createFormulaEvaluator()); } + + LocaleUtil.setUserLocale(Locale.US); } @AfterClass diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java index 1598c7a8f0..edaa5da042 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java @@ -17,18 +17,20 @@ package org.apache.poi.ss.formula.functions; +import static org.junit.Assert.assertEquals; + +import java.util.Locale; + import org.apache.poi.ss.formula.eval.BlankEval; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.StringEval; import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.util.LocaleUtil; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; -import java.util.Locale; - -import static org.junit.Assert.assertEquals; - /** * Tests for Excel function DATEVALUE() * @@ -36,6 +38,16 @@ import static org.junit.Assert.assertEquals; */ public final class TestDateValue { + @BeforeClass + public static void init() { + LocaleUtil.setUserLocale(Locale.US); + } + + @AfterClass + public static void clear() { + LocaleUtil.setUserLocale(null); + } + @Test public void testDateValue() { confirmDateValue(new StringEval("2020-02-01"), 43862); @@ -56,18 +68,13 @@ public final class TestDateValue { confirmDateValueError(new StringEval("non-date text")); - LocaleUtil.setUserLocale(Locale.ENGLISH); - try { - // // EXCEL - confirmDateValue(new StringEval("8/22/2011"), 40777); // Serial number of a date entered as text. - confirmDateValue(new StringEval("22-MAY-2011"), 40685); // Serial number of a date entered as text. - confirmDateValue(new StringEval("2011/02/23"), 40597); // Serial number of a date entered as text. - - // LibreOffice compatibility - confirmDateValue(new StringEval("1954-07-20"), 19925); - } finally { - LocaleUtil.setUserLocale(null); - } + // // EXCEL + confirmDateValue(new StringEval("8/22/2011"), 40777); // Serial number of a date entered as text. + confirmDateValue(new StringEval("22-MAY-2011"), 40685); // Serial number of a date entered as text. + confirmDateValue(new StringEval("2011/02/23"), 40597); // Serial number of a date entered as text. + + // LibreOffice compatibility + confirmDateValue(new StringEval("1954-07-20"), 19925); } private ValueEval invokeDateValue(ValueEval text) { |