poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1702321 - in /poi/trunk/src/testcases/org/apache/poi: hssf/usermodel/TestHSSFDateUtil.java ss/formula/functions/TestText.java
Date Thu, 10 Sep 2015 21:31:00 GMT
Author: kiwiwings
Date: Thu Sep 10 21:31:00 2015
New Revision: 1702321

URL: http://svn.apache.org/r1702321
Log:
forbidden apis fixes - timezone fix ... will it work?

Modified:
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestText.java

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java?rev=1702321&r1=1702320&r2=1702321&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java Thu Sep 10
21:31:00 2015
@@ -42,13 +42,28 @@ import org.apache.poi.hssf.HSSFTestDataS
 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);
         }
     }
 

Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestText.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestText.java?rev=1702321&r1=1702320&r2=1702321&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestText.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestText.java Thu Sep 10 21:31:00
2015
@@ -115,6 +115,7 @@ public final class TestText {
             // update: now the locale will be (if not set otherwise) always Locale.getDefault()
(see LocaleUtil)
             DateFormatSymbols dfs = DateFormatSymbols.getInstance(LocaleUtil.getUserLocale());
             SimpleDateFormat sdf = new SimpleDateFormat("MMMM", dfs);
+            sdf.setTimeZone(LocaleUtil.getUserTimeZone());
             String november = sdf.format(LocaleUtil.getLocaleCalendar(2015,10,1).getTime());
     
             // Again with Java style



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message