abstract class AbstractExpressionEvaluatingCondition
extends java.lang.Object
ExecutionCondition
that
evaluate expressions configured via annotations to determine if a container
or test is enabled.
Expressions can be any of the following.
#{systemProperties['os.name'].toLowerCase().contains('mac')}
Environment
— for example:
${smoke.tests.enabled}
true
EnabledIf
,
DisabledIf
Constructor and Description |
---|
AbstractExpressionEvaluatingCondition() |
Modifier and Type | Method and Description |
---|---|
protected <A extends java.lang.annotation.Annotation> |
evaluateAnnotation(java.lang.Class<A> annotationType,
java.util.function.Function<A,java.lang.String> expressionExtractor,
java.util.function.Function<A,java.lang.String> reasonExtractor,
java.util.function.Function<A,java.lang.Boolean> loadContextExtractor,
boolean enabledOnTrue,
ExtensionContext context)
Evaluate the expression configured via the supplied annotation type on
the
AnnotatedElement for the supplied ExtensionContext . |
private <A extends java.lang.annotation.Annotation> |
evaluateExpression(java.lang.String expression,
boolean loadContext,
java.lang.Class<A> annotationType,
ExtensionContext context) |
private static <A extends java.lang.annotation.Annotation> |
findMergedAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.Class<A> annotationType) |
private static final Log logger
protected <A extends java.lang.annotation.Annotation> ConditionEvaluationResult evaluateAnnotation(java.lang.Class<A> annotationType, java.util.function.Function<A,java.lang.String> expressionExtractor, java.util.function.Function<A,java.lang.String> reasonExtractor, java.util.function.Function<A,java.lang.Boolean> loadContextExtractor, boolean enabledOnTrue, ExtensionContext context)
AnnotatedElement
for the supplied ExtensionContext
.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 the loadContext
flag from the annotationenabledOnTrue
- indicates whether the returned ConditionEvaluationResult
should be enabled
if the expression
evaluates to true
context
- the ExtensionContext
enabled
if the container
or test should be enabled; otherwise disabled
private <A extends java.lang.annotation.Annotation> boolean evaluateExpression(java.lang.String expression, boolean loadContext, java.lang.Class<A> annotationType, ExtensionContext context)
private static <A extends java.lang.annotation.Annotation> java.util.Optional<A> findMergedAnnotation(java.lang.reflect.AnnotatedElement element, java.lang.Class<A> annotationType)