db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean T. Anderson" <...@bristowhill.com>
Subject Re: JUnit common methods & assert messages WAS Re: [jira] Commented: (DERBY-827) Performance can be improved by re-using language ResultSets across Activation executions.
Date Mon, 05 Mar 2007 16:04:27 GMT
Daniel John Debrunner wrote:
...
> This style of code
> can be expensive at runtime:
>    for (int i = 0; i < count; i++) {
>       assertEquals("Testing at iteration " + i, f(i), g(i));
>    }

I'm a fresh guinea pig eager for advice ....

In CallableTest.java I have this:

    for(int i=0; i< updateCount.length; i++){
        if(i == 1) // The second command in the batch failed.
            assertEquals("Batch updateCount", -3, updateCount[i]);
        else
            assertEquals("Batch updateCount", -1, updateCount[i]);
    }

would this be advised?

    for(int i=0; i< updateCount.length; i++){

        if( (i == 1) && (updateCount[i] != -3) )
            assertEquals("Batch updateCount", -3, updateCount[i]);
        else if (updateCount[i] != -1)
            assertEquals("Batch updateCount", -1, updateCount[i]);
    }

thanks,

 -jean


Mime
View raw message