db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Russell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-218) checkValues() method of *MapStringValueCollections doesn't work
Date Fri, 18 Nov 2005 22:49:41 GMT
    [ http://issues.apache.org/jira/browse/JDO-218?page=comments#action_12358029 ] 

Craig Russell commented on JDO-218:
-----------------------------------

It seems like this code has a similar problem in case there is a BigDecimal as a value.

+                            String expectedVal = (String) expected.get(expectedKey);
+                            String actualValue = (String)
+                               actual.get(TestUtil.getBigDecimalKey(expectedKey,
+                                                                    actualKeySet));
+                            if (!expectedVal.equals(actualValue)) {
+                                sbuf.append("\nFor element " + i +
+                                    " expected value = " + expectedVal +
+                                    " actual Value = " + actualValue);
+                           }

Could it be rewritten to use compareTo instead:

+                            String expectedVal = (String) expected.get(expectedKey);
+                            String actualValue = (String)
+                               actual.get(TestUtil.getBigDecimalKey(expectedKey,
+                                                                    actualKeySet));
+                            if (expectedVal.equals(actualValue)) {continue;}
if (expectedVal instanceof Comparable && ((Comparable)expectedVal.compareTo(actualValue))
== 0) {continue;}
+                                sbuf.append("\nFor element " + i +
+                                    " expected value = " + expectedVal +
+                                    " actual Value = " + actualValue);
+                           }



> checkValues() method of *MapStringValueCollections doesn't work
> ---------------------------------------------------------------
>
>          Key: JDO-218
>          URL: http://issues.apache.org/jira/browse/JDO-218
>      Project: JDO
>         Type: Bug
>   Components: tck20
>     Reporter: Michelle Caisse
>     Assignee: Michelle Caisse
>  Attachments: JDO-218.patch
>
> No map fields with BigDecimal values compare okay.  There are several problems.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message