aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2015-09-10 21:31:00 +0000
committerAndreas Beeker <kiwiwings@apache.org>2015-09-10 21:31:00 +0000
commit9f26731f44ba4eccabdb82f0a23f91eb755787fc (patch)
tree72546e1a15948a998654551c99bac7e0fd4458fb /src/testcases/org/apache/poi/hssf
parent91e804553b72900a14ffbf702474c077c4b94c2f (diff)
downloadpoi-9f26731f44ba4eccabdb82f0a23f91eb755787fc.tar.gz
poi-9f26731f44ba4eccabdb82f0a23f91eb755787fc.zip
forbidden apis fixes - timezone fix ... will it work?
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1702321 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf')
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
index 224c2bd7dc..8e8a06d3c1 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
@@ -42,13 +42,28 @@ import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.util.LocaleUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
* Class TestHSSFDateUtil
*/
-public final class TestHSSFDateUtil {
+public class TestHSSFDateUtil {
+ static TimeZone userTimeZone;
+
+ @BeforeClass
+ public static void setCEST() {
+ userTimeZone = LocaleUtil.getUserTimeZone();
+ LocaleUtil.setUserTimeZone(TimeZone.getTimeZone("CEST"));
+ }
+
+ @AfterClass
+ public static void resetTimeZone() {
+ LocaleUtil.setUserTimeZone(userTimeZone);
+ }
+
/**
* Checks the date conversion functions in the HSSFDateUtil class.
*/
@@ -136,9 +151,9 @@ public final class TestHSSFDateUtil {
cal.set(Calendar.HOUR_OF_DAY, hour);
Date javaDate = HSSFDateUtil.getJavaDate(excelDate, false);
+ double actDate = HSSFDateUtil.getExcelDate(javaDate, false);
assertEquals("Checking " + hour + " hours on Daylight Saving Time start date",
- excelDate,
- HSSFDateUtil.getExcelDate(javaDate, false), oneMinute);
+ excelDate, actDate, oneMinute);
}
}