Package rife.bld.testing
Class RetryExtension
java.lang.Object
rife.bld.testing.RetryExtension
- All Implemented Interfaces:
Extension,InvocationInterceptor,TestInstantiationAwareExtension,TestTemplateInvocationContextProvider
public class RetryExtension
extends Object
implements TestTemplateInvocationContextProvider, InvocationInterceptor
JUnit extension that retries a failing
RetryTest method.
Implements TestTemplateInvocationContextProvider and InvocationInterceptor
to integrate with @TestTemplate. The test is retried up to RetryTest.value()
times with an optional RetryTest.delay() in seconds.
If RetryTest.withExceptions() is specified, only matching exception types
(including causes in the cause chain) will trigger a retry.
If a retry succeeds, the test passes. If all retries fail, the last exception is thrown.
- Since:
- 1.0
- Author:
- Erik C. Thauvin, Guillaume Laforge
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
InvocationInterceptor.Invocation<T extends Object>Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
TestInstantiationAwareExtension.ExtensionContextScope -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinterceptTestTemplateMethod(InvocationInterceptor.Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) booleansupportsTestTemplate(ExtensionContext context) Methods inherited from class java.lang.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, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestMethodMethods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
getTestInstantiationExtensionContextScopeMethods inherited from interface org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
mayReturnZeroTestTemplateInvocationContexts
-
Constructor Details
-
RetryExtension
public RetryExtension()
-
-
Method Details
-
interceptTestTemplateMethod
public void interceptTestTemplateMethod(InvocationInterceptor.Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable - Specified by:
interceptTestTemplateMethodin interfaceInvocationInterceptor- Throws:
Throwable
-
supportsTestTemplate
- Specified by:
supportsTestTemplatein interfaceTestTemplateInvocationContextProvider
-
provideTestTemplateInvocationContexts
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) - Specified by:
provideTestTemplateInvocationContextsin interfaceTestTemplateInvocationContextProvider
-