InvocationInterceptor
defines the API for Extensions
that wish to intercept calls to test code.
Each method in this class must call Invocation#proceed()
or Invocation#skip()
exactly once on the supplied invocation. Otherwise, the
enclosing test or container will be reported as failed.
The default implementation calls proceed()
on the supplied invocation.
Consult the documentation in Extension
for details on
constructor requirements.
Invocation
, ReflectiveInvocationContext
, ExtensionContext
Modifier and Type | Class and Description |
---|---|
public static interface | InvocationInterceptor.
the result type T>An invocation that returns a result and may throw a |
Modifier and Type | Method and Description |
---|---|
public default void | interceptAfterAllMethod(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of an |
public default void | interceptAfterEachMethod(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of an |
public default void | interceptBeforeAllMethod(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of a |
public default void | interceptBeforeEachMethod(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of a |
public default void | interceptDynamicTest(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the current extension context; never extensionContext)null
Deprecated
use
Intercept the invocation of a interceptDynamicTest(Invocation, DynamicTestInvocationContext, ExtensionContext) instead
DynamicTest .
|
public default void | interceptDynamicTest(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of a |
public default < the result type T> T | Returns: the result of the invocation; nevernull the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of a test class constructor. |
public default < the result type T> T | Returns: the result of the invocation; potentiallynull the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of a |
public default void | interceptTestMethod(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of a |
public default void | interceptTestTemplateMethod(InvocationInterceptor.
the invocation that is being intercepted; never
invocation,null the context of the invocation that is being
intercepted; never invocationContext, ExtensionContext null the current extension context; never extensionContext)null Intercept the invocation of a |
interceptAfterAllMethod | back to summary |
---|---|
public default void interceptAfterAllMethod(InvocationInterceptor. Intercept the invocation of an
|
interceptAfterEachMethod | back to summary |
---|---|
public default void interceptAfterEachMethod(InvocationInterceptor. Intercept the invocation of an
|
interceptBeforeAllMethod | back to summary |
---|---|
public default void interceptBeforeAllMethod(InvocationInterceptor. Intercept the invocation of a
|
interceptBeforeEachMethod | back to summary |
---|---|
public default void interceptBeforeEachMethod(InvocationInterceptor. Intercept the invocation of a
|
interceptDynamicTest | back to summary |
---|---|
public default void interceptDynamicTest(InvocationInterceptor. Deprecated use Intercept the invocation of a
|
interceptDynamicTest | back to summary |
---|---|
public default void interceptDynamicTest(InvocationInterceptor. Intercept the invocation of a
|
interceptTestClassConstructor | back to summary |
---|---|
public default <T> T interceptTestClassConstructor(InvocationInterceptor. Intercept the invocation of a test class constructor. Note that the test class may not have been initialized (static initialization) when this method is invoked.
|
interceptTestFactoryMethod | back to summary |
---|---|
public default <T> T interceptTestFactoryMethod(InvocationInterceptor. Intercept the invocation of a
|
interceptTestMethod | back to summary |
---|---|
public default void interceptTestMethod(InvocationInterceptor. Intercept the invocation of a
|
interceptTestTemplateMethod | back to summary |
---|---|
public default void interceptTestTemplateMethod(InvocationInterceptor. Intercept the invocation of a
|
Throwable
.
This interface is not intended to be implemented by clients.
Modifier and Type | Method and Description |
---|---|
public T | |
public default void |
proceed | back to summary |
---|---|
public T proceed() throws Throwable Proceed with this invocation.
|
skip | back to summary |
---|---|
public default void skip() Explicitly skip this invocation. This allows to bypass the check that |