Exception Handling
Exceptions thrown during the test execution may be intercepted and handled accordingly
before propagating further, so that certain actions like error logging or resource releasing
may be defined in specialized Extensions. JUnit Jupiter offers API for Extensions that
wish to handle exceptions thrown during @Test methods via TestExecutionExceptionHandler
and for those thrown during one of test lifecycle methods (@BeforeAll, @BeforeEach,
@AfterEach and @AfterAll) via LifecycleMethodExecutionExceptionHandler.
The following example shows an extension which will swallow all instances of IOException
but rethrow any other type of exception.
An exception handling extension that filters IOExceptions in test execution