Top Inners Fields Constructors Methods
org.junit.jupiter.engine.extension

pack-priv Class TimeoutExtension

extends Object
implements BeforeAllCallback, BeforeEachCallback, InvocationInterceptor
Class Inheritance
All Implemented Interfaces
org.junit.jupiter.api.extension.InvocationInterceptor, org.junit.jupiter.api.extension.TestInstantiationAwareExtension, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback
Static Imports
org.junit.jupiter.api.Timeout.ThreadMode.SAME_THREAD

Since
5.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface

Field Summary

Modifier and TypeField and Description
private static final String
private static final ExtensionContext.Namespace
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
beforeAll(ExtensionContext context)

Implements org.junit.jupiter.api.extension.BeforeAllCallback.beforeAll.

Callback that is invoked once before all tests in the current container.

public void
beforeEach(ExtensionContext context)

Implements org.junit.jupiter.api.extension.BeforeEachCallback.beforeEach.

Callback that is invoked before an individual test and any user-defined setup methods for that test have been executed.

private <T extends @Nullable Object> InvocationInterceptor.Invocation<T>
decorate(InvocationInterceptor.Invocation<T> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext, @Nullable TimeoutDuration timeout, TimeoutConfiguration timeoutConfiguration)

private String
describe(ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext)

private @Nullable Timeout.ThreadMode
private @Nullable TimeoutDuration
getDefaultTimeout(TimeoutExtension.TimeoutProvider defaultTimeoutProvider, TimeoutConfiguration timeoutConfiguration)

private TimeoutConfiguration
public TestInstantiationAwareExtension.ExtensionContextScope
getTestInstantiationExtensionContextScope(ExtensionContext rootContext)

Overrides default org.junit.jupiter.api.extension.TestInstantiationAwareExtension.getTestInstantiationExtensionContextScope.

Determine whether this extension should receive a test-method scoped ExtensionContext during the instantiation of test classes or processing of test instances.

private <T extends @Nullable Object> T
intercept(InvocationInterceptor.Invocation<T> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext, @Nullable TimeoutDuration explicitTimeout, TimeoutExtension.TimeoutProvider defaultTimeoutProvider)

public void
public void
public void
public void
private void
private <T extends @Nullable Object> T
public <T extends @Nullable Object> T
interceptTestFactoryMethod(InvocationInterceptor.Invocation<T> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext)

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestFactoryMethod.

Intercept the invocation of a @TestFactory method, such as a @RepeatedTest or @ParameterizedTest method.

public void
public void
private void
private Optional<TimeoutDuration>
private Optional<Timeout.ThreadMode>
private Timeout.ThreadMode
resolveTimeoutThreadMode(ExtensionContext extensionContext, TimeoutConfiguration timeoutConfiguration)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GLOBAL_TIMEOUT_CONFIG_KEYback to summary
private static final String GLOBAL_TIMEOUT_CONFIG_KEY
NAMESPACEback to summary
private static final ExtensionContext.Namespace NAMESPACE
TESTABLE_METHOD_TIMEOUT_KEYback to summary
private static final String TESTABLE_METHOD_TIMEOUT_KEY
TESTABLE_METHOD_TIMEOUT_THREAD_MODE_KEYback to summary
private static final String TESTABLE_METHOD_TIMEOUT_THREAD_MODE_KEY

Constructor Detail

TimeoutExtensionback to summary
pack-priv TimeoutExtension()

Method Detail

beforeAllback to summary
public void beforeAll(ExtensionContext context)

Implements org.junit.jupiter.api.extension.BeforeAllCallback.beforeAll.

Doc from org.junit.jupiter.api.extension.BeforeAllCallback.beforeAll.

Callback that is invoked once before all tests in the current container.

Annotations
@Override
beforeEachback to summary
public void beforeEach(ExtensionContext context)

Implements org.junit.jupiter.api.extension.BeforeEachCallback.beforeEach.

Doc from org.junit.jupiter.api.extension.BeforeEachCallback.beforeEach.

Callback that is invoked before an individual test and any user-defined setup methods for that test have been executed.

Annotations
@Override
decorateback to summary
private <T extends @Nullable Object> InvocationInterceptor.Invocation<T> decorate(InvocationInterceptor.Invocation<T> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext, @Nullable TimeoutDuration timeout, TimeoutConfiguration timeoutConfiguration)
describeback to summary
private String describe(ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext)
getAnnotationThreadModeback to summary
private @Nullable Timeout.ThreadMode getAnnotationThreadMode(ExtensionContext extensionContext)
getDefaultTimeoutback to summary
private @Nullable TimeoutDuration getDefaultTimeout(TimeoutExtension.TimeoutProvider defaultTimeoutProvider, TimeoutConfiguration timeoutConfiguration)
getGlobalTimeoutConfigurationback to summary
private TimeoutConfiguration getGlobalTimeoutConfiguration(ExtensionContext extensionContext)
getTestInstantiationExtensionContextScopeback to summary
public TestInstantiationAwareExtension.ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext)

Overrides default org.junit.jupiter.api.extension.TestInstantiationAwareExtension.getTestInstantiationExtensionContextScope.

Doc from org.junit.jupiter.api.extension.TestInstantiationAwareExtension.getTestInstantiationExtensionContextScope.

Determine whether this extension should receive a test-method scoped ExtensionContext during the instantiation of test classes or processing of test instances.

If an extension returns TEST_METHOD from this method, methods defined in the following extension APIs will be called with a test-method scoped ExtensionContext instead of a test-class scoped context. Note, however, that a test-class scoped context will always be supplied if the PER_CLASS test instance lifecycle is used.

When a test-method scoped ExtensionContext is supplied, implementations of the above extension APIs will observe the following differences.

Note

The behavior which is enabled by returning TEST_METHOD from this method will become the default in future versions of JUnit. To ensure forward compatibility, extension authors are therefore advised to opt into this feature, even if they do not require the new functionality.

Annotations
@Override
interceptback to summary
private <T extends @Nullable Object> T intercept(InvocationInterceptor.Invocation<T> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext, @Nullable TimeoutDuration explicitTimeout, TimeoutExtension.TimeoutProvider defaultTimeoutProvider) throws Throwable
interceptAfterAllMethodback to summary
public void interceptAfterAllMethod(InvocationInterceptor.Invocation<@Nullable Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptAfterAllMethod.

Doc from org.junit.jupiter.api.extension.InvocationInterceptor.interceptAfterAllMethod.

Intercept the invocation of an @AfterAll method.

Annotations
@Override
Exceptions
Throwable:
in case of failures
interceptAfterEachMethodback to summary
public void interceptAfterEachMethod(InvocationInterceptor.Invocation<@Nullable Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptAfterEachMethod.

Doc from org.junit.jupiter.api.extension.InvocationInterceptor.interceptAfterEachMethod.

Intercept the invocation of an @AfterEach method.

Annotations
@Override
Exceptions
Throwable:
in case of failures
interceptBeforeAllMethodback to summary
public void interceptBeforeAllMethod(InvocationInterceptor.Invocation<@Nullable Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptBeforeAllMethod.

Doc from org.junit.jupiter.api.extension.InvocationInterceptor.interceptBeforeAllMethod.

Intercept the invocation of a @BeforeAll method.

Annotations
@Override
Exceptions
Throwable:
in case of failures
interceptBeforeEachMethodback to summary
public void interceptBeforeEachMethod(InvocationInterceptor.Invocation<@Nullable Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptBeforeEachMethod.

Doc from org.junit.jupiter.api.extension.InvocationInterceptor.interceptBeforeEachMethod.

Intercept the invocation of a @BeforeEach method.

Annotations
@Override
Exceptions
Throwable:
in case of failures
interceptLifecycleMethodback to summary
private void interceptLifecycleMethod(InvocationInterceptor.Invocation<@Nullable Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext, TimeoutExtension.TimeoutProvider defaultTimeoutProvider) throws Throwable
interceptTestableMethodback to summary
private <T extends @Nullable Object> T interceptTestableMethod(InvocationInterceptor.Invocation<T> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext, TimeoutExtension.TimeoutProvider defaultTimeoutProvider) throws Throwable
interceptTestFactoryMethodback to summary
public <T extends @Nullable Object> T interceptTestFactoryMethod(InvocationInterceptor.Invocation<T> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestFactoryMethod.

Doc from org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestFactoryMethod.

Intercept the invocation of a @TestFactory method, such as a @RepeatedTest or @ParameterizedTest method.

Annotations
@Override
Exceptions
Throwable:
in case of failures
interceptTestMethodback to summary
public void interceptTestMethod(InvocationInterceptor.Invocation<@Nullable Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestMethod.

Doc from org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestMethod.

Intercept the invocation of a @Test method.

Annotations
@Override
Exceptions
Throwable:
in case of failures
interceptTestTemplateMethodback to summary
public void interceptTestTemplateMethod(InvocationInterceptor.Invocation<@Nullable Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable

Overrides default org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestTemplateMethod.

Doc from org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestTemplateMethod.

Intercept the invocation of a @TestTemplate method.

Annotations
@Override
Exceptions
Throwable:
in case of failures
readAndStoreTimeoutSoChildrenInheritItback to summary
private void readAndStoreTimeoutSoChildrenInheritIt(ExtensionContext context)
readTimeoutFromAnnotationback to summary
private Optional<TimeoutDuration> readTimeoutFromAnnotation(Optional<AnnotatedElement> element)
Annotations
@SuppressWarnings:OptionalUsedAsFieldOrParameterType
readTimeoutThreadModeFromAnnotationback to summary
private Optional<Timeout.ThreadMode> readTimeoutThreadModeFromAnnotation(Optional<AnnotatedElement> element)
Annotations
@SuppressWarnings:OptionalUsedAsFieldOrParameterType
resolveTimeoutThreadModeback to summary
private Timeout.ThreadMode resolveTimeoutThreadMode(ExtensionContext extensionContext, TimeoutConfiguration timeoutConfiguration)
org.junit.jupiter.engine.extension back to summary

private Interface TimeoutExtension.TimeoutProvider

extends Function<TimeoutConfiguration, Optional<TimeoutDuration>>
Annotations
@FunctionalInterface

Method Summary

Inherited from java.util.function.Function:
andThenapplycomposeidentity