Class DisabledIfCondition
java.lang.Object
org.springframework.test.context.junit.jupiter.DisabledIfCondition
- All Implemented Interfaces:
- ExecutionCondition, Extension
DisabledIfCondition is an ExecutionCondition
that supports the @DisabledIf annotation when using the Spring
TestContext Framework in conjunction with the JUnit Jupiter testing framework.
Any attempt to use the DisabledIfCondition without the presence of
@DisabledIf will result in an enabled
ConditionEvaluationResult.
- Since:
- 5.0
- Author:
- Sam Brannen
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected <A extends Annotation>
 ConditionEvaluationResultevaluateAnnotation(Class<A> annotationType, Function<A, String> expressionExtractor, Function<A, String> reasonExtractor, Function<A, Boolean> loadContextExtractor, boolean enabledOnTrue, ExtensionContext context) Evaluate the expression configured via the supplied annotation type on theAnnotatedElementfor the suppliedExtensionContext.Containers and tests are disabled if@DisabledIfis present on the corresponding test class or test method and the configured expression evaluates totrue.
- 
Constructor Details- 
DisabledIfConditionpublic DisabledIfCondition()
 
- 
- 
Method Details- 
evaluateExecutionConditionContainers and tests are disabled if@DisabledIfis present on the corresponding test class or test method and the configured expression evaluates totrue.
- 
evaluateAnnotationprotected <A extends Annotation> ConditionEvaluationResult evaluateAnnotation(Class<A> annotationType, Function<A, String> expressionExtractor, Function<A, String> reasonExtractor, Function<A, Boolean> loadContextExtractor, boolean enabledOnTrue, ExtensionContext context) Evaluate the expression configured via the supplied annotation type on theAnnotatedElementfor the suppliedExtensionContext.- Parameters:
- annotationType- the type of annotation to process
- expressionExtractor- a function that extracts the expression from the annotation
- reasonExtractor- a function that extracts the reason from the annotation
- loadContextExtractor- a function that extracts the- loadContextflag from the annotation
- enabledOnTrue- indicates whether the returned- ConditionEvaluationResultshould be- enabledif the expression evaluates to- true
- context- the- ExtensionContext
- Returns:
- enabledif the container or test should be enabled; otherwise- disabled
 
 
-