Top Description Fields Constructors Methods
org.junit.jupiter.api.extension

public Class ConditionEvaluationResult

extends Object
Class Inheritance
Annotations
@API
status:STABLE
since:5.0
Static Imports
org.apiguardian.api.API.Status.STABLE

The result of evaluating an ExecutionCondition.
Since
5.0

Field Summary

Modifier and TypeField and Description
private final boolean
private final Optional<String>

Constructor Summary

AccessConstructor and Description
private
ConditionEvaluationResult(boolean enabled, @Nullable String reason)

Method Summary

Modifier and TypeMethod and Description
public static ConditionEvaluationResult

Returns:

a disabled ConditionEvaluationResult with the given reason or an empty reason if the reason is unknown
disabled
(@Nullable String
the reason why the container or test should be disabled; may be null or blank if the reason is unknown
reason
)

Factory for creating disabled results.

public static ConditionEvaluationResult

Returns:

a disabled ConditionEvaluationResult with the given reason(s) or an empty reason if the reasons are unknown
disabled
(@Nullable String
the default reason why the container or test should be disabled; may be null or blank if the default reason is unknown
reason
,
@Nullable String
the custom reason why the container or test should be disabled; may be null or blank if the custom reason is unknown
customReason
)

Factory for creating disabled results with custom reasons added by the user.

public static ConditionEvaluationResult

Returns:

an enabled ConditionEvaluationResult with the given reason or an empty reason if the reason is unknown
enabled
(@Nullable String
the reason why the container or test should be enabled; may be null or blank if the reason is unknown
reason
)

Factory for creating enabled results.

public Optional<String>
getReason()

Get the reason why the container or test should be enabled or disabled, if available.

public boolean

Returns:

true if the container or test should be disabled
isDisabled
()

Whether the container or test should be disabled.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

enabledback to summary
private final boolean enabled
reasonback to summary
private final Optional<String> reason

Constructor Detail

ConditionEvaluationResultback to summary
private ConditionEvaluationResult(boolean enabled, @Nullable String reason)

Method Detail

disabledback to summary
public static ConditionEvaluationResult disabled(@Nullable String reason)

Factory for creating disabled results.

Parameters
reason:@Nullable String

the reason why the container or test should be disabled; may be null or blank if the reason is unknown

Returns:ConditionEvaluationResult

a disabled ConditionEvaluationResult with the given reason or an empty reason if the reason is unknown

See Also
StringUtils#isBlank(String)
disabledback to summary
public static ConditionEvaluationResult disabled(@Nullable String reason, @Nullable String customReason)

Factory for creating disabled results with custom reasons added by the user.

If non-blank default and custom reasons are provided, they will be concatenated using the format: "reason ==> customReason".

Parameters
reason:@Nullable String

the default reason why the container or test should be disabled; may be null or blank if the default reason is unknown

customReason:@Nullable String

the custom reason why the container or test should be disabled; may be null or blank if the custom reason is unknown

Returns:ConditionEvaluationResult

a disabled ConditionEvaluationResult with the given reason(s) or an empty reason if the reasons are unknown

Annotations
@API
status:STABLE
since:5.7
Since
5.7
See Also
StringUtils#isBlank(String)
enabledback to summary
public static ConditionEvaluationResult enabled(@Nullable String reason)

Factory for creating enabled results.

Parameters
reason:@Nullable String

the reason why the container or test should be enabled; may be null or blank if the reason is unknown

Returns:ConditionEvaluationResult

an enabled ConditionEvaluationResult with the given reason or an empty reason if the reason is unknown

See Also
StringUtils#isBlank(String)
getReasonback to summary
public Optional<String> getReason()

Get the reason why the container or test should be enabled or disabled, if available.

isDisabledback to summary
public boolean isDisabled()

Whether the container or test should be disabled.

Returns:boolean

true if the container or test should be disabled

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override