Class TimeoutExtension
java.lang.Object
org.junitpioneer.vintage.TimeoutExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.InvocationInterceptor
class TimeoutExtension
extends Object
implements org.junit.jupiter.api.extension.InvocationInterceptor
This extension implements the timeout behavior of
@Test, where a test is failed if it takes longer to finish
than the specified time.
Note that this is different from JUnit 4's @Test parameter, which would abandon the test if it ran to
long and continue with the remainder of the suite. As Jupiter's extension API is currently not powerful enough
to interact with its threading model, this could not be implemented.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionannotatedTimeout(org.junit.jupiter.api.extension.ExtensionContext context) voidinterceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) private voidproceedWithTimeout(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ExtensionContext extensionContext, long timeout) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptDynamicTest, interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestTemplateMethod
-
Field Details
-
TEST_RAN_TOO_LONG
- See Also:
-
-
Constructor Details
-
TimeoutExtension
TimeoutExtension()
-
-
Method Details
-
interceptTestMethod
public 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:
interceptTestMethodin interfaceorg.junit.jupiter.api.extension.InvocationInterceptor- Throws:
Throwable
-
proceedWithTimeout
private void proceedWithTimeout(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ExtensionContext extensionContext, long timeout) -
annotatedTimeout
-