类 EnabledIfCondition
- java.lang.Object
- org.springframework.test.context.junit.jupiter.EnabledIfCondition
- 所有已实现的接口:
ExecutionCondition
,Extension
public class EnabledIfCondition extends Object
EnabledIfCondition
is anExecutionCondition
that supports the@EnabledIf
annotation when using the Spring TestContext Framework in conjunction with JUnit 5's Jupiter programming model.Any attempt to use the
EnabledIfCondition
without the presence of@EnabledIf
will result in an enabledConditionEvaluationResult
.- 从以下版本开始:
- 5.0
- 作者:
- Sam Brannen
- 另请参阅:
EnabledIf
,DisabledIf
,SpringExtension
构造器概要
构造器 构造器 说明 EnabledIfCondition()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected <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 theAnnotatedElement
for the suppliedExtensionContext
.ConditionEvaluationResult
evaluateExecutionCondition(ExtensionContext context)
Containers and tests are enabled if@EnabledIf
is present on the corresponding test class or test method and the configured expression evaluates totrue
.
构造器详细资料
EnabledIfCondition
public EnabledIfCondition()
方法详细资料
evaluateExecutionCondition
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context)
Containers and tests are enabled if@EnabledIf
is present on the corresponding test class or test method and the configured expression evaluates totrue
.
evaluateAnnotation
protected <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 theAnnotatedElement
for the suppliedExtensionContext
.- 参数:
annotationType
- the type of annotation to processexpressionExtractor
- a function that extracts the expression from the annotationreasonExtractor
- a function that extracts the reason from the annotationloadContextExtractor
- a function that extracts theloadContext
flag from the annotationenabledOnTrue
- indicates whether the returnedConditionEvaluationResult
should beenabled
if the expression evaluates totrue
context
- theExtensionContext
- 返回:
enabled
if the container or test should be enabled; otherwisedisabled