Please sign in to comment.
Actual exception added in ExpectedException
When using the ExpectedException to test for an exception to occur, it throws an AssertionError when thrown exception does not match the expected exception. Issue is however that in the JUnit runner results only the actual exceptions message is shown and not the stacktrace. To fix that, the actual exception is added to the cause of the AssertionError, giving the exceptions in a format like: java.lang.AssertionError: [reason] Expected: [expected exception] got: [actual exception + message] at [AssertionError stacktrace] Caused by: [actual exception + message] at [actual exception stacktrace]
- Loading branch information...
Showing with 8 additions and 1 deletion.