Class RepetitionExtension
- All Implemented Interfaces:
ExecutionCondition
,Extension
,ParameterResolver
,TestWatcher
RepetitionExtension
implements the following extension APIs to support
repetitions of a @RepeatedTest
method.
ParameterResolver
to resolveRepetitionInfo
argumentsTestWatcher
to track the failure countExecutionCondition
to disable the repetition if the failure threshold has been exceeded
- Since:
- 5.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluate this condition for the suppliedExtensionContext
.resolveParameter
(ParameterContext parameterContext, ExtensionContext extensionContext) Resolve an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.boolean
supportsParameter
(ParameterContext parameterContext, ExtensionContext extensionContext) Determine if this resolver supports resolution of an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.void
testFailed
(ExtensionContext context, Throwable cause) Invoked after a test has failed.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.TestWatcher
testAborted, testDisabled, testSuccessful
-
Field Details
-
repetitionInfo
-
-
Constructor Details
-
RepetitionExtension
RepetitionExtension(DefaultRepetitionInfo repetitionInfo)
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) Description copied from interface:ParameterResolver
Determine if this resolver supports resolution of an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.The
Method
orConstructor
in which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable()
.- Specified by:
supportsParameter
in interfaceParameterResolver
- Parameters:
parameterContext
- the context for the parameter for which an argument should be resolved; nevernull
extensionContext
- the extension context for theExecutable
about to be invoked; nevernull
- Returns:
true
if this resolver can resolve an argument for the parameter- See Also:
-
resolveParameter
public RepetitionInfo resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) Description copied from interface:ParameterResolver
Resolve an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.This method is only called by the framework if
ParameterResolver.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext)
previously returnedtrue
for the sameParameterContext
andExtensionContext
.The
Method
orConstructor
in which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable()
.- Specified by:
resolveParameter
in interfaceParameterResolver
- Parameters:
parameterContext
- the context for the parameter for which an argument should be resolved; nevernull
extensionContext
- the extension context for theExecutable
about to be invoked; nevernull
- Returns:
- the resolved argument for the parameter; may only be
null
if the parameter type is not a primitive - See Also:
-
testFailed
Description copied from interface:TestWatcher
Invoked after a test has failed.The default implementation does nothing. Concrete implementations can override this method as appropriate.
- Specified by:
testFailed
in interfaceTestWatcher
- Parameters:
context
- the current extension context; nevernull
cause
- the throwable that caused test failure; may benull
-
evaluateExecutionCondition
Description copied from interface:ExecutionCondition
Evaluate this condition for the suppliedExtensionContext
.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.
- Specified by:
evaluateExecutionCondition
in interfaceExecutionCondition
- Parameters:
context
- the current extension context; nevernull
- Returns:
- the result of evaluating this condition; never
null
-