Package org.junit.jupiter.api.extension
JUnit Jupiter API for writing extensions.
-
Interface Summary Interface Description AfterAllCallback AfterAllCallbackdefines the API forExtensionsthat wish to provide additional behavior to test containers once after all tests in the container have been executed.AfterClassTemplateInvocationCallback AfterClassTemplateInvocationCallbackdefines the API forExtensionsthat wish to provide additional behavior once before each invocation of a@ClassTemplate.AfterEachCallback AfterEachCallbackdefines the API forExtensionsthat wish to provide additional behavior to tests after an individual test and any user-defined teardown methods (e.g.,@AfterEachmethods) for that test have been executed.AfterTestExecutionCallback AfterTestExecutionCallbackdefines the API forExtensionsthat wish to provide additional behavior to tests immediately after an individual test has been executed but before any user-defined teardown methods (e.g.,@AfterEachmethods) have been executed for that test.AnnotatedElementContext AnnotatedElementContextencapsulates the context in which anAnnotatedElementis declared.BeforeAllCallback BeforeAllCallbackdefines the API forExtensionsthat wish to provide additional behavior to test containers once before all tests in the container have been executed.BeforeClassTemplateInvocationCallback BeforeClassTemplateInvocationCallbackdefines the API forExtensionsthat wish to provide additional behavior once before each invocation of a@ClassTemplate.BeforeEachCallback BeforeEachCallbackdefines the API forExtensionsthat wish to provide additional behavior to tests before an individual test and any user-defined setup methods (e.g.,@BeforeEachmethods) for that test have been executed.BeforeTestExecutionCallback BeforeTestExecutionCallbackdefines the API forExtensionsthat wish to provide additional behavior to tests immediately before an individual test is executed but after any user-defined setup methods (e.g.,@BeforeEachmethods) have been executed for that test.ClassTemplateInvocationContext ClassTemplateInvocationContextrepresents the context of a single invocation of a@ClassTemplate.ClassTemplateInvocationContextProvider ClassTemplateInvocationContextProviderdefines the API forExtensionsthat wish to provide one or multiple contexts for the invocation of a@ClassTemplate.DynamicTestInvocationContext DynamicTestInvocationContextrepresents the context of a single invocation of a dynamic test.ExecutableInvoker ExecutableInvokerallows invoking methods and constructors with support for dynamic resolution of parameters viaParameterResolvers.ExecutionCondition ExecutionConditiondefines theExtensionAPI for programmatic, conditional test execution.Extension Marker interface for all extensions.ExtensionContext ExtensionContextencapsulates the context in which the current test or container is being executed.ExtensionContext.Store Storeprovides methods for extensions to save and retrieve data.ExtensionContext.Store.CloseableResource Deprecated. Please extendAutoCloseabledirectly.InvocationInterceptor InvocationInterceptordefines the API forExtensionsthat wish to intercept calls to test code.InvocationInterceptor.Invocation<T> An invocation that returns a result and may throw aThrowable.LifecycleMethodExecutionExceptionHandler LifecycleMethodExecutionExceptionHandlerdefines the API forExtensionsthat wish to handle exceptions thrown during the execution of@BeforeAll,@BeforeEach,@AfterEach, and@AfterAlllifecycle methods.ParameterContext ParameterContextencapsulates the context in which anExecutablewill be invoked for a givenParameter.ParameterResolver ParameterResolverdefines the API forExtensionsthat wish to dynamically resolve arguments for parameters at runtime.PreInterruptCallback PreInterruptCallbackdefines the API forExtensionsthat wish to be called prior to invocations ofThread.interrupt()by theTimeoutextension.PreInterruptContext PreInterruptContextencapsulates the context in which anbeforeThreadInterruptmethod is called.ReflectiveInvocationContext<T extends java.lang.reflect.Executable> ReflectiveInvocationContextencapsulates the context of a reflective invocation of an executable (method or constructor).TestExecutionExceptionHandler TestExecutionExceptionHandlerdefines the API forExtensionsthat wish to handle exceptions thrown during test execution.TestInstanceFactory TestInstanceFactoryContext TestInstanceFactoryContextencapsulates the context in which a test class is to be instantiated by aTestInstanceFactory.TestInstancePostProcessor TestInstancePostProcessordefines the API forExtensionsthat wish to post-process test instances.TestInstancePreConstructCallback TestInstancePreConstructCallbackdefines the API forExtensionsthat wish to be invoked prior to creation of test instances.TestInstancePreDestroyCallback TestInstancePreDestroyCallbackdefines the API forExtensionsthat wish to process test instances after they have been used in tests but before they are destroyed.TestInstances TestInstancesencapsulates the test instances of a test.TestInstantiationAwareExtension TestInstantiationAwareExtensiondefines the API forExtensionsthat are aware of or influence the instantiation of test classes.TestTemplateInvocationContext TestTemplateInvocationContextrepresents the context of a single invocation of a test template.TestTemplateInvocationContextProvider TestTemplateInvocationContextProviderdefines the API forExtensionsthat wish to provide one or multiple contexts for the invocation of a@TestTemplatemethod.TestWatcher TestWatcherdefines the API forExtensionsthat wish to process test results. -
Class Summary Class Description ConditionEvaluationResult The result of evaluating anExecutionCondition.ExtensionContext.Namespace ANamespaceis used to provide a scope for data saved by extensions within aExtensionContext.Store.MediaType Deprecated. UseMediaTypeinstead. -
Enum Summary Enum Description ExtensionContext.StoreScope StoreScopeis an enumeration of the different scopes forExtensionContext.Storeinstances.TestInstantiationAwareExtension.ExtensionContextScope ExtensionContextScopeis used to define the scope of theExtensionContextsupplied to an extension during the instantiation of test classes or processing of test instances. -
Exception Summary Exception Description ExtensionConfigurationException Thrown if an error is encountered regarding the configuration of an extension.ExtensionContextException Thrown if an error is encountered regarding the use of anExtensionContextorExtensionContext.Store.ParameterResolutionException Thrown if an error is encountered in the configuration or execution of aParameterResolver.TemplateInvocationValidationException TemplateInvocationValidationExceptionis an exception thrown by aTestTemplateInvocationContextProviderorClassTemplateInvocationContextProviderif a validation fails when while providing or closingStreamof invocation contexts.TestInstantiationException Thrown if an error is encountered during the execution of aTestInstanceFactory. -
Annotation Types Summary Annotation Type Description ClassTemplateInvocationLifecycleMethod Internal marker annotation for lifecycle methods specific to implementations ofClassTemplateInvocationContextProvider.ExtendWith @ExtendWithis a repeatable annotation that is used to register extensions for the annotated test class, test interface, test method, parameter, or field.Extensions @Extensionsis a container for one or more@ExtendWithdeclarations.RegisterExtension @RegisterExtensionis used to register anExtensionvia a field in a test class.