class RepetitionExtension extends java.lang.Object implements ParameterResolver, TestWatcher, ExecutionCondition
RepetitionExtension implements the following extension APIs to support
repetitions of a @RepeatedTest method.
ParameterResolver to resolve RepetitionInfo argumentsTestWatcher to track the failure countExecutionCondition to disable the repetition if the
failure threshold has been
exceeded| Modifier and Type | Field and Description |
|---|---|
private DefaultRepetitionInfo |
repetitionInfo |
| Constructor and Description |
|---|
RepetitionExtension(DefaultRepetitionInfo repetitionInfo) |
| Modifier and Type | Method and Description |
|---|---|
ConditionEvaluationResult |
evaluateExecutionCondition(ExtensionContext context)
Evaluate this condition for the supplied
ExtensionContext. |
RepetitionInfo |
resolveParameter(ParameterContext parameterContext,
ExtensionContext extensionContext)
Resolve an argument for the
Parameter in the supplied ParameterContext
for the supplied ExtensionContext. |
boolean |
supportsParameter(ParameterContext parameterContext,
ExtensionContext extensionContext)
Determine if this resolver supports resolution of an argument for the
Parameter in the supplied ParameterContext for the supplied
ExtensionContext. |
void |
testFailed(ExtensionContext context,
java.lang.Throwable cause)
Invoked after a test has failed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittestAborted, testDisabled, testSuccessfulprivate final DefaultRepetitionInfo repetitionInfo
RepetitionExtension(DefaultRepetitionInfo repetitionInfo)
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
ParameterResolverParameter in the supplied ParameterContext for the supplied
ExtensionContext.
The Method or Constructor
in which the parameter is declared can be retrieved via
ParameterContext.getDeclaringExecutable().
supportsParameter in interface ParameterResolverparameterContext - the context for the parameter for which an argument should
be resolved; never nullextensionContext - the extension context for the Executable
about to be invoked; never nulltrue if this resolver can resolve an argument for the parameterParameterResolver.resolveParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext),
ParameterContextpublic RepetitionInfo resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
ParameterResolverParameter in the supplied ParameterContext
for the supplied ExtensionContext.
This method is only called by the framework if ParameterResolver.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext)
previously returned true for the same ParameterContext
and ExtensionContext.
The Method or Constructor
in which the parameter is declared can be retrieved via
ParameterContext.getDeclaringExecutable().
resolveParameter in interface ParameterResolverparameterContext - the context for the parameter for which an argument should
be resolved; never nullextensionContext - the extension context for the Executable
about to be invoked; never nullnull if the
parameter type is not a primitiveParameterResolver.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext),
ParameterContextpublic void testFailed(ExtensionContext context, java.lang.Throwable cause)
TestWatcherThe default implementation does nothing. Concrete implementations can override this method as appropriate.
testFailed in interface TestWatchercontext - the current extension context; never nullcause - the throwable that caused test failure; may be nullpublic ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context)
ExecutionConditionExtensionContext.
An enabled result indicates that the container or test should be executed; whereas, a disabled result indicates that the container or test should not be executed.
evaluateExecutionCondition in interface ExecutionConditioncontext - the current extension context; never nullnull