[ 
https://issues.apache.org/jira/browse/DERBY-2304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472176
 ] 

Jean T. Anderson commented on DERBY-2304:
-----------------------------------------

Following up on Dan's suggestion to implement a assertDecimalEquals method, 
this works:

public void assertDecimalEquals (String msg, String val1, BigDecimal val2)
    {
        BigDecimal expected = (new BigDecimal(val1));
        assertTrue(msg +
            " expected:<" + val1 + "> but was:<" + val2.toString() + ">",
            expected.compareTo(val2)==0);
    }

It gets called like this:

   assertDecimalEquals("OUT 2", "33.3330",        cs.getBigDecimal(2));

If an assert fails, it outputs a message that is consistent with the style of 
other assertEquals messages:

   OUT 9 expected: <-88888888.0000> but was <-99999999.0000>

Does anyone spot any problems with this approach?

> Convert derbynet/callable.java to junit
> ---------------------------------------
>
>                 Key: DERBY-2304
>                 URL: https://issues.apache.org/jira/browse/DERBY-2304
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Jean T. Anderson
>         Assigned To: Jean T. Anderson
>            Priority: Minor
>         Attachments: derby-2304-preview-2.diff, derby-2304-preview-3.diff, 
> derby-2304-preview.diff
>
>
> Convert the derbynet.callable.java test to the junit framework.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to