db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r330953 - /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java
Date Sat, 05 Nov 2005 01:29:32 GMT
Author: mcaisse
Date: Fri Nov  4 17:29:31 2005
New Revision: 330953

URL: http://svn.apache.org/viewcvs?rev=330953&view=rev
Log:
JDO-201 Fixed ClassCastException, added BigDecimal test code block, test passes

Modified:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java?rev=330953&r1=330952&r2=330953&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java
Fri Nov  4 17:29:31 2005
@@ -16,7 +16,9 @@
  
 package org.apache.jdo.tck.models.fieldtypes;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Collection;
 import java.util.Vector;
 
@@ -131,7 +133,8 @@
                     ArrayListCollections.fieldSpecs[i]);
             value = (Collection)TestUtil.makeNewVectorInstance(
                     valueType, order);
-            collect.set(i, (ArrayList) value);
+            ArrayList arrayListValue = new ArrayList(value);
+            collect.set(i, arrayListValue);
             if (debug)
                 logger.debug("Set " + i + "th value to: " + value.toString());
         }
@@ -154,9 +157,32 @@
                         + " . ");
                 continue;
             }
-            if (! expected.equals(actual)) {
-                sbuf.append("\nFor element " + i + ", expected = " +
+            else if (! expected.equals(actual)) {
+                if (TestUtil.getFieldSpecs(ArrayListCollections.fieldSpecs[i]
+                            ).equals("BigDecimal")) {
+            	    if (debug) {
+                	logger.debug("Field is " + i + " Class name is "
+                          +  actual.getClass().getName()
+			  + "   isInstance of Vector is "
+			  + actual.getClass().isInstance((Object)new Vector()));
+		    }
+                    List expectedL = (List)expected;
+                    List actualL = (List)actual;
+                    for (int j = 0; j < actualL.size(); ++j) {
+                        BigDecimal bigDecCompareWith =
+                            (BigDecimal)expectedL.get(j);
+                        Object bigDecVal = actualL.get(j);
+                        if ((bigDecCompareWith.compareTo(bigDecVal) != 0)) {
+                            sbuf.append("\nFor element " + i + "(" + j +
+                                    "), expected = " + expected +
+                                    ", actual = " + actualL + " . ");
+                        }
+                    }
+                }
+                else {
+                    sbuf.append("\nFor element " + i + ", expected = " +
                         expected + ", actual = " + actual + " . ");
+                }
             }
         }
         if (sbuf.length() > 0) {



Mime
View raw message