Class RepetitionExtension
- All Implemented Interfaces:
ExecutionCondition,Extension,ParameterResolver,TestWatcher
RepetitionExtension implements the following extension APIs to support
repetitions of a @RepeatedTest method.
ParameterResolverto resolveRepetitionInfoargumentsTestWatcherto track the failure countExecutionConditionto 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 theParameterin the suppliedParameterContextfor the suppliedExtensionContext.booleansupportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) Determine if this resolver supports resolution of an argument for theParameterin the suppliedParameterContextfor the suppliedExtensionContext.voidtestFailed(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, waitMethods 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:ParameterResolverDetermine if this resolver supports resolution of an argument for theParameterin the suppliedParameterContextfor the suppliedExtensionContext.The
MethodorConstructorin which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable().- Specified by:
supportsParameterin interfaceParameterResolver- Parameters:
parameterContext- the context for the parameter for which an argument should be resolved; nevernullextensionContext- the extension context for theExecutableabout to be invoked; nevernull- Returns:
trueif this resolver can resolve an argument for the parameter- See Also:
-
resolveParameter
public RepetitionInfo resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) Description copied from interface:ParameterResolverResolve an argument for theParameterin the suppliedParameterContextfor 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 returnedtruefor the sameParameterContextandExtensionContext.The
MethodorConstructorin which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable().- Specified by:
resolveParameterin interfaceParameterResolver- Parameters:
parameterContext- the context for the parameter for which an argument should be resolved; nevernullextensionContext- the extension context for theExecutableabout to be invoked; nevernull- Returns:
- the resolved argument for the parameter; may only be
nullif the parameter type is not a primitive - See Also:
-
testFailed
Description copied from interface:TestWatcherInvoked after a test has failed.The default implementation does nothing. Concrete implementations can override this method as appropriate.
- Specified by:
testFailedin interfaceTestWatcher- Parameters:
context- the current extension context; nevernullcause- the throwable that caused test failure; may benull
-
evaluateExecutionCondition
Description copied from interface:ExecutionConditionEvaluate 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:
evaluateExecutionConditionin interfaceExecutionCondition- Parameters:
context- the current extension context; nevernull- Returns:
- the result of evaluating this condition; never
null
-