-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Using ExpectedException to test for expected exception does not work as intended, as Jukito's InjectedAfterStatements.evaluate() wraps and rethrows all exceptions as org.junit.internal.runners.model.MultipleFailureException.MultipleFailureException(List<Throwable>)
This behavior would be ok for multiple exceptions, e.g. when also catching Guice-related exceptions in addition to exceptions which occurred in the actual test. But when there is only one exception, this should be re-thrown directly instead of wrapping it into MultipleFailureException.
This can actually easily be done by using org.junit.runners.model.MultipleFailureException.assertEmpty(List<Throwable>) which first checks if there is only a single exception and if so rethrows it directly. Multiple exceptions are still wrapped into a MultipleFailureException as it used to be in Jukito.