Skip to content

Jukito does not work well with ExpectedException rule #83

@metaschell

Description

@metaschell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions