@FunctionalInterface @API(status=STABLE, since="5.0") public interface TestExecutionExceptionHandler extends Extension
TestExecutionExceptionHandlerdefines the API for
Extensionsthat wish to handle exceptions thrown during test execution.
In this context, test execution refers to the physical
invocation of a
@Test method and not to any test-level extensions
Common use cases include swallowing an exception if it's anticipated or rolling back a transaction in certain error scenarios.
Implementations must provide a no-args constructor.
|Modifier and Type||Method and Description|
Handle the supplied
void handleTestExecutionException(ExtensionContext context, Throwable throwable) throws Throwable
Implementors must perform one of the following.
throwable, thereby preventing propagation.
If the supplied
throwable is swallowed, subsequent
TestExecutionExceptionHandlers will not be invoked; otherwise,
the next registered
TestExecutionExceptionHandler (if there is
one) will be invoked with any
Throwable thrown by this handler.
Note that the
exception in the supplied
ExtensionContext will not
Throwable thrown during invocation of the corresponding
context- the current extension context; never
Throwableto handle; never