Description
Actually, when a @theory fails, it throws a ParameterizedAssertionError that gives theory's method name and used argument(s) : ok, we know what failed.
But to know why it failed, one have to go deep down the stack trace (20+ lines of call stack) to retrieve the root cause of the failure, obviously the message returned by the failing assertion.
Example :
There was 1 failure:
1) returnFizzWhenValueIsAMultipleOfThree(FizzBuzzTest)
org.junit.experimental.theories.internal.ParameterizedAssertionError: returnFizzWhenValueIsAMultipleOfThree(three)
at
* Starting from here, information is irrelevant when trying to understand why a theory failed*
org.junit.experimental.theories.Theories$TheoryAnchor.reportParameterizedError(Theories.java:183)
<26 lines of call stack cut>
...
at org.junit.runner.JUnitCore.main(JUnitCore.java:38)
* Caused by: org.junit.ComparisonFailure: expected:<[fizz]> but was:<[a string]>* At least !!
at org.junit.Assert.assertEquals(Assert.java:124)
...
I would suggest to add assertion failure message as a part of the ParameterizedAssertionError, in order to have all relevant and needed information on the very first line of the stack trace.