There are quite a lot of assertions that don't give any details if a test fails.

For example, the following currently fails when using Harmony:

testIncreasingTolerance(org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegratorTest)
java.lang.AssertionError:
        at org.junit.Assert.fail(Assert.java:74)
        at org.junit.Assert.assertTrue(Assert.java:37)
        at org.junit.Assert.assertTrue(Assert.java:46)
        at 
org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegratorTest.testIncreasingTolerance(AdamsBashforthIntegratorTest.java:89)

Obviously one can find the code from the line number, but that does
not actually get one much further as there's no indication what the
values are:

            assertTrue(handler.getMaximalValueError() < (36.0 *
scalAbsoluteTolerance));

Seems to me it might be useful to create some additional assert
methods, for example:

assertLessThan([message,] maximum, actual)

which would report the max and actual values if the check failed.

As far as I can tell, this is not currently supported by JUnit3/4 -
only assertSame/assertEquals report the expected and actual values.

WDYT?

There are also lots of cases of assert() calls without a message;
again this means digging into the test code to find the problem.

I propose to add messages to at least the ones that Harmony triggers. OK?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to