db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r418846 - /db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java
Date Mon, 03 Jul 2006 20:49:29 GMT
Author: tomdz
Date: Mon Jul  3 13:49:29 2006
New Revision: 418846

URL: http://svn.apache.org/viewvc?rev=418846&view=rev
Log:
Made alteration tests more robust

Modified:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java?rev=418846&r1=418845&r2=418846&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java Mon Jul  3 13:49:29
2006
@@ -18,6 +18,8 @@
 
 import java.util.List;
 
+import org.apache.commons.beanutils.DynaBean;
+
 import junit.framework.Test;
 
 /**
@@ -569,9 +571,14 @@
 
         assertEquals((Object)"test", beans.get(0), "avalue1");
         assertEquals(new Integer(3), beans.get(0), "avalue2");
-        // we're assuming the default algorithm  which will apply the default value even
-        // to existing columns
-        assertEquals(new Double(1.0), beans.get(0), "avalue3");
+
+        // we cannot be sure whether the default algorithm is used (which will apply the
+        // default value even to existing columns with NULL in it) or the database supports
+        // it dircetly (in which case it might still be NULL)
+        Object avalue3 = ((DynaBean)beans.get(0)).get("avalue3");
+
+        assertTrue((avalue3 == null) || new Double(1.0).equals(avalue3));
+        
         assertEquals((Object)null, beans.get(0), "avalue4");
     }
 
@@ -610,7 +617,12 @@
 
         List beans = getRows("roundtrip");
 
-        assertEquals(new Integer(2), beans.get(0), "avalue");
+        // we cannot be sure whether the default algorithm is used (which will apply the
+        // default value even to existing columns with NULL in it) or the database supports
+        // it dircetly (in which case it might still be NULL)
+        Object avalue = ((DynaBean)beans.get(0)).get("avalue");
+
+        assertTrue((avalue == null) || new Integer(2).equals(avalue));
     }
 
     /**
@@ -907,7 +919,12 @@
 
         List beans = getRows("roundtrip");
 
-        assertEquals(new Integer(0), beans.get(0), "avalue");
+        // we cannot be sure whether the default algorithm is used (which will apply the
+        // default value even to existing columns with NULL in it) or the database supports
+        // it dircetly (in which case it might still be NULL)
+        Object avalue = ((DynaBean)beans.get(0)).get("avalue");
+
+        assertTrue((avalue == null) || new Integer(0).equals(avalue));
     }
 
     /**



Mime
View raw message