db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r672663 - /db/jdo/trunk/api2-legacy/test/java/javax/jdo/identity/ObjectIdentityTest.java
Date Sun, 29 Jun 2008 19:19:47 GMT
Author: clr
Date: Sun Jun 29 12:19:47 2008
New Revision: 672663

URL: http://svn.apache.org/viewvc?rev=672663&view=rev
Log:
JDO-598 Updated ObjectIdentity to allow Comparable classes

Modified:
    db/jdo/trunk/api2-legacy/test/java/javax/jdo/identity/ObjectIdentityTest.java

Modified: db/jdo/trunk/api2-legacy/test/java/javax/jdo/identity/ObjectIdentityTest.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/test/java/javax/jdo/identity/ObjectIdentityTest.java?rev=672663&r1=672662&r2=672663&view=diff
==============================================================================
--- db/jdo/trunk/api2-legacy/test/java/javax/jdo/identity/ObjectIdentityTest.java (original)
+++ db/jdo/trunk/api2-legacy/test/java/javax/jdo/identity/ObjectIdentityTest.java Sun Jun
29 12:19:47 2008
@@ -142,6 +142,17 @@
         assertEquals ("Equal ObjectIdentity instances compare not equal.", c1, c2);
     }
 
+    public void testDateCompareTo() {
+    	ObjectIdentity c1 = new ObjectIdentity(Object.class, new Date(1));
+    	ObjectIdentity c2 = new ObjectIdentity(Object.class, new Date(1));
+    	ObjectIdentity c3 = new ObjectIdentity(Object.class, new Date(2));
+        ObjectIdentity c4 = new ObjectIdentity(Class.class, new Date(1));
+        assertEquals("Equal ObjectIdentity instances compare not equal.", 0, c1.compareTo(c2));
+        assertTrue("Not equal ObjectIdentity instances have wrong compareTo result", c1.compareTo(c3)
< 0);
+        assertTrue("Not equal ObjectIdentity instances have wrong compareTo result", c3.compareTo(c1)
> 0); 
+        assertTrue("Not equal ObjectIdentity instances have wrong compareTo result", c1.compareTo(c4)
> 0);
+    }
+
     public void testBadStringConstructorNullClass() {
         try {
             ObjectIdentity c1 = new ObjectIdentity(null, "1");



Mime
View raw message