You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/12/30 07:28:44 UTC

svn commit: r1896528 - /xmlbeans/trunk/src/test/java/xmlcursor/xpath/complex/detailed/TypesTest.java

Author: fanningpj
Date: Thu Dec 30 07:28:44 2021
New Revision: 1896528

URL: http://svn.apache.org/viewvc?rev=1896528&view=rev
Log:
try to make date test more robust

Modified:
    xmlbeans/trunk/src/test/java/xmlcursor/xpath/complex/detailed/TypesTest.java

Modified: xmlbeans/trunk/src/test/java/xmlcursor/xpath/complex/detailed/TypesTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlcursor/xpath/complex/detailed/TypesTest.java?rev=1896528&r1=1896527&r2=1896528&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlcursor/xpath/complex/detailed/TypesTest.java (original)
+++ xmlbeans/trunk/src/test/java/xmlcursor/xpath/complex/detailed/TypesTest.java Thu Dec 30 07:28:44 2021
@@ -52,6 +52,23 @@ public class TypesTest {
     }
 
     @Test
+    public void testZDate() {
+        boolean negativeOffset = OffsetDateTime.now().getOffset().getTotalSeconds() < 0;
+        res = o.selectPath("xs:date(\"2000-01-01Z\")");
+        assertEquals(1, res.length);
+        Calendar d = ((XmlDate) res[0]).getCalendarValue();
+        if (negativeOffset) {
+            assertEquals(1999, d.get(Calendar.YEAR));
+            assertEquals(11, d.get(Calendar.MONTH));
+            assertEquals(31, d.get(Calendar.DAY_OF_MONTH));
+        } else {
+            assertEquals(2000, d.get(Calendar.YEAR));
+            assertEquals(0, d.get(Calendar.MONTH));
+            assertEquals(1, d.get(Calendar.DAY_OF_MONTH));
+        }
+    }
+
+    @Test
     public void testDecimal() {
         res = o.selectPath(
             "seconds-from-dateTime(xs:dateTime('1997-07-16T19:20:30+01:00'))");



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