- 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 java.lang.Object implements org.junit.jupiter.api.extension.InvocationInterceptorThis 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
@Testparameter, 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.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringTEST_RAN_TOO_LONG
-
Constructor Summary
Constructors Constructor Description TimeoutExtension()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.Optional<java.lang.Long>annotatedTimeout(org.junit.jupiter.api.extension.ExtensionContext context)voidinterceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)private voidproceedWithTimeout(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ExtensionContext extensionContext, long timeout)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptDynamicTest, interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestTemplateMethod
-
-
-
-
Field Detail
-
TEST_RAN_TOO_LONG
static final java.lang.String TEST_RAN_TOO_LONG
- See Also:
- Constant Field Values
-
-
Method Detail
-
interceptTestMethod
public void interceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Throwable- Specified by:
interceptTestMethodin interfaceorg.junit.jupiter.api.extension.InvocationInterceptor- Throws:
java.lang.Throwable
-
proceedWithTimeout
private void proceedWithTimeout(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ExtensionContext extensionContext, long timeout)
-
annotatedTimeout
private java.util.Optional<java.lang.Long> annotatedTimeout(org.junit.jupiter.api.extension.ExtensionContext context)
-
-