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 Type
    Method
    Description
    static Function<org.awaitility.core.ConditionFactory,org.awaitility.core.ConditionFactory>
    Creates a default scenario customizer that will try to find an ExecutorService in the given ApplicationContext in the following order: A unique ExecutorService bean defined A ThreadPoolTaskExecutor bean defined (the default Spring Boot creates in case no Executor is explicitly defined in the ApplicationContext
    Function<org.awaitility.core.ConditionFactory,org.awaitility.core.ConditionFactory>
    Return a customizer to be applied to the Scenario 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 the Scenario 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 an ExecutorService in the given ApplicationContext in the following order:
      1. A unique ExecutorService bean defined
      2. A ThreadPoolTaskExecutor bean defined (the default Spring Boot creates in case no Executor is explicitly defined in the ApplicationContext
      Parameters:
      context - must not be null.
      Returns:
      will never be null.
    • 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 interface org.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 interface org.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 interface org.junit.jupiter.api.extension.InvocationInterceptor
      Throws:
      Throwable