Interface ScenarioCustomizer
- All Superinterfaces:
org.junit.jupiter.api.extension.Extension
,org.junit.jupiter.api.extension.InvocationInterceptor
public interface ScenarioCustomizer
extends org.junit.jupiter.api.extension.InvocationInterceptor
A JUnit
InvocationInterceptor
to register a default customizer to be applied to all Scenario
instances associated with that test case.- Author:
- Oliver Drotbohm
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T extends Object>
-
Method Summary
Modifier and TypeMethodDescriptionstatic Function<org.awaitility.core.ConditionFactory,
org.awaitility.core.ConditionFactory> forwardExecutorService
(ApplicationContext context) Creates a default scenario customizer that will try to find anExecutorService
in the givenApplicationContext
in the following order: A uniqueExecutorService
bean defined AThreadPoolTaskExecutor
bean defined (the default Spring Boot creates in case noExecutor
is explicitly defined in theApplicationContext
Function<org.awaitility.core.ConditionFactory,
org.awaitility.core.ConditionFactory> getDefaultCustomizer
(Method method, ApplicationContext context) Return a customizer to be applied to theScenario
instance handed into the given method.default <T> T
interceptTestFactoryMethod
(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) default void
interceptTestMethod
(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) default void
interceptTestTemplateMethod
(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Methods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptDynamicTest, interceptDynamicTest, interceptTestClassConstructor
-
Method Details
-
getDefaultCustomizer
Function<org.awaitility.core.ConditionFactory,org.awaitility.core.ConditionFactory> getDefaultCustomizer(Method method, ApplicationContext context) Return a customizer to be applied to theScenario
instance handed into the given method.- Parameters:
method
- will never be null.context
- will never be null.- Returns:
- must not be null.
-
forwardExecutorService
static Function<org.awaitility.core.ConditionFactory,org.awaitility.core.ConditionFactory> forwardExecutorService(ApplicationContext context) Creates a default scenario customizer that will try to find anExecutorService
in the givenApplicationContext
in the following order:- A unique
ExecutorService
bean defined - A
ThreadPoolTaskExecutor
bean defined (the default Spring Boot creates in case noExecutor
is explicitly defined in theApplicationContext
- Parameters:
context
- must not be null.- Returns:
- will never be null.
- A unique
-
interceptTestTemplateMethod
default void interceptTestTemplateMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptTestTemplateMethod
in interfaceorg.junit.jupiter.api.extension.InvocationInterceptor
- Throws:
Throwable
-
interceptTestFactoryMethod
default <T> T interceptTestFactoryMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptTestFactoryMethod
in interfaceorg.junit.jupiter.api.extension.InvocationInterceptor
- Throws:
Throwable
-
interceptTestMethod
default void interceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptTestMethod
in interfaceorg.junit.jupiter.api.extension.InvocationInterceptor
- Throws:
Throwable
-