aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2023-09-28 22:35:00 +0000
committerPJ Fanning <fanningpj@apache.org>2023-09-28 22:35:00 +0000
commitfdad7e14081dee0046556e1c4d848039afcd522b (patch)
treece5142367809985211877a7001928060bc434914 /poi
parent57e1f4b79e291e6867175a9a2bf2485376ac6341 (diff)
downloadpoi-fdad7e14081dee0046556e1c4d848039afcd522b.tar.gz
poi-fdad7e14081dee0046556e1c4d848039afcd522b.zip
[github-523] set locales for some tests. This closes #523
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912583 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays.java14
-rw-r--r--poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataFormat.java14
2 files changed, 28 insertions, 0 deletions
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays.java
index c3b804995a..fab91e1fd0 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestDays.java
@@ -23,10 +23,14 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.FormulaError;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.time.LocalDate;
+import java.util.Locale;
import static org.apache.poi.ss.util.Utils.addRow;
import static org.apache.poi.ss.util.Utils.assertDouble;
@@ -37,6 +41,16 @@ import static org.apache.poi.ss.util.Utils.assertError;
*/
public class TestDays {
+ @BeforeAll
+ static void setUp() {
+ LocaleUtil.setUserLocale(Locale.US);
+ }
+
+ @AfterAll
+ static void tearDown() {
+ LocaleUtil.setUserLocale(null);
+ }
+
//https://support.microsoft.com/en-us/office/days-function-57740535-d549-4395-8728-0f07bff0b9df
@Test
void testMicrosoftExample1() throws IOException {
diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataFormat.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
index 65ee8ffa49..eed2fd3cc3 100644
--- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
+++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestDataFormat.java
@@ -22,8 +22,12 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
+import java.util.Locale;
import org.apache.poi.ss.ITestDataProvider;
+import org.apache.poi.util.LocaleUtil;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
/**
@@ -45,6 +49,16 @@ public abstract class BaseTestDataFormat {
assertEquals(-1, BuiltinFormats.getBuiltinFormat(customFmt));
}
+ @BeforeAll
+ static void setUp() {
+ LocaleUtil.setUserLocale(Locale.US);
+ }
+
+ @AfterAll
+ static void tearDown() {
+ LocaleUtil.setUserLocale(null);
+ }
+
@Test
public final void testBuiltinFormats() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {