Hi there,
I'm not sure if this is absolutely the best forum for this post, so forgive me if it's off-topic.
I've come across a behavior in JUnit that seems like a bug to me. If you write:
assertTrue( /* some condition... */ );
and the assertion fails, the failure message you get says "AssertionFailed: null". This is horribly confusing, and caused me to waste some time looking for nulls in the condition, and wondering why it wasn't simply throwing NullPointerException instead.
A much better, clearer message would have been "AssertionFailed: false".
Looking at the source code for Assert.java, I see this:
/**
* Asserts that a condition is true. If it isn't it throws an
* {@link AssertionError} without a message.
*
* @param condition
* condition to be checked
*/
static public void assertTrue(boolean condition) {
assertTrue(null, condition);
}
I would rather if this were implemented:
assertTrue("false", condition);
You could make a similar change to assertFalse(boolean), supplying "true" as the string.
Thanks,
Greg