cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1566140 - /cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java
Date Sat, 08 Feb 2014 21:25:16 GMT
Author: aadamchik
Date: Sat Feb  8 21:25:16 2014
New Revision: 1566140

URL: http://svn.apache.org/r1566140
Log:
reducing TS comparison precision to whole seconds

Modified:
    cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java

Modified: cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java?rev=1566140&r1=1566139&r2=1566140&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java
Sat Feb  8 21:25:16 2014
@@ -730,7 +730,11 @@ public class ReturnTypesMappingTest exte
         Object columnValue = testRead.get(columnName);
         assertNotNull(columnValue);
         assertEquals(Date.class, columnValue.getClass());
-        assertEquals(timestampValue.toString(), columnValue.toString());
+        
+        // some DB's, noteably MySQL, strip the milliseconds from timestamps,
+        // so comparing within 1 second precision
+        long delta = timestampValue.getTime() - ((Date) columnValue).getTime();
+        assertTrue(delta < 1000);
     }
 
     public void testTIMESTAMP2() throws Exception {
@@ -745,8 +749,11 @@ public class ReturnTypesMappingTest exte
         Date columnValue = testRead.getTimestampColumn();
         assertNotNull(columnValue);
         assertEquals(Date.class, columnValue.getClass());
-        assertEquals(timestampValue.toString(), columnValue.toString());
-    }
+        
+        // some DB's, noteably MySQL, strip the milliseconds from timestamps,
+        // so comparing within 1 second precision
+        long delta = timestampValue.getTime() - ((Date) columnValue).getTime();
+        assertTrue(delta < 1000);    }
 
     public void testTINYINT() throws Exception {
         String columnName = "TINYINT_COLUMN";



Mime
View raw message