Package org.junit.jupiter.api.condition
Class MethodBasedCondition<A extends java.lang.annotation.Annotation>
- java.lang.Object
-
- org.junit.jupiter.api.condition.MethodBasedCondition<A>
-
- All Implemented Interfaces:
ExecutionCondition
,Extension
- Direct Known Subclasses:
DisabledIfCondition
,EnabledIfCondition
abstract class MethodBasedCondition<A extends java.lang.annotation.Annotation> extends java.lang.Object implements ExecutionCondition
- Since:
- 5.7
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<A>
annotationType
private java.util.function.Function<A,java.lang.String>
customDisabledReason
private java.util.function.Function<A,java.lang.String>
methodName
-
Constructor Summary
Constructors Constructor Description MethodBasedCondition(java.lang.Class<A> annotationType, java.util.function.Function<A,java.lang.String> methodName, java.util.function.Function<A,java.lang.String> customDisabledReason)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private boolean
acceptsExtensionContextArgument(java.lang.reflect.Method method)
private ConditionEvaluationResult
buildConditionEvaluationResult(boolean methodResult, A annotation)
private ConditionEvaluationResult
enabledByDefault()
ConditionEvaluationResult
evaluateExecutionCondition(ExtensionContext context)
Evaluate this condition for the suppliedExtensionContext
.private java.lang.reflect.Method
findMethod(java.lang.Class<?> clazz, java.lang.String methodName)
private java.lang.reflect.Method
getConditionMethod(java.lang.String fullyQualifiedMethodName, ExtensionContext context)
private boolean
invokeConditionMethod(java.lang.reflect.Method method, ExtensionContext context)
protected abstract boolean
isEnabled(boolean methodResult)
-
-
-
Field Detail
-
annotationType
private final java.lang.Class<A extends java.lang.annotation.Annotation> annotationType
-
methodName
private final java.util.function.Function<A extends java.lang.annotation.Annotation,java.lang.String> methodName
-
customDisabledReason
private final java.util.function.Function<A extends java.lang.annotation.Annotation,java.lang.String> customDisabledReason
-
-
Method Detail
-
evaluateExecutionCondition
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context)
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
-
getConditionMethod
private java.lang.reflect.Method getConditionMethod(java.lang.String fullyQualifiedMethodName, ExtensionContext context)
-
findMethod
private java.lang.reflect.Method findMethod(java.lang.Class<?> clazz, java.lang.String methodName)
-
invokeConditionMethod
private boolean invokeConditionMethod(java.lang.reflect.Method method, ExtensionContext context)
-
acceptsExtensionContextArgument
private boolean acceptsExtensionContextArgument(java.lang.reflect.Method method)
-
buildConditionEvaluationResult
private ConditionEvaluationResult buildConditionEvaluationResult(boolean methodResult, A annotation)
-
isEnabled
protected abstract boolean isEnabled(boolean methodResult)
-
enabledByDefault
private ConditionEvaluationResult enabledByDefault()
-
-