15
15
import java .util .Optional ;
16
16
17
17
import org .apiguardian .api .API ;
18
+ import org .jspecify .annotations .Nullable ;
18
19
import org .junit .platform .commons .util .StringUtils ;
19
20
import org .junit .platform .commons .util .ToStringBuilder ;
20
21
@@ -35,7 +36,7 @@ public class ConditionEvaluationResult {
35
36
* or an <em>empty</em> reason if the reason is unknown
36
37
* @see StringUtils#isBlank(String)
37
38
*/
38
- public static ConditionEvaluationResult enabled (String reason ) {
39
+ public static ConditionEvaluationResult enabled (@ Nullable String reason ) {
39
40
return new ConditionEvaluationResult (true , reason );
40
41
}
41
42
@@ -48,7 +49,7 @@ public static ConditionEvaluationResult enabled(String reason) {
48
49
* or an <em>empty</em> reason if the reason is unknown
49
50
* @see StringUtils#isBlank(String)
50
51
*/
51
- public static ConditionEvaluationResult disabled (String reason ) {
52
+ public static ConditionEvaluationResult disabled (@ Nullable String reason ) {
52
53
return new ConditionEvaluationResult (false , reason );
53
54
}
54
55
@@ -69,7 +70,8 @@ public static ConditionEvaluationResult disabled(String reason) {
69
70
* @see StringUtils#isBlank(String)
70
71
*/
71
72
@ API (status = STABLE , since = "5.7" )
72
- public static ConditionEvaluationResult disabled (String reason , String customReason ) {
73
+ @ SuppressWarnings ("NullAway" ) // StringUtils.isBlank() does not yet have a nullability @Contract
74
+ public static ConditionEvaluationResult disabled (@ Nullable String reason , @ Nullable String customReason ) {
73
75
if (StringUtils .isBlank (reason )) {
74
76
return disabled (customReason );
75
77
}
@@ -84,7 +86,7 @@ public static ConditionEvaluationResult disabled(String reason, String customRea
84
86
private final Optional <String > reason ;
85
87
86
88
@ SuppressWarnings ("NullAway" ) // StringUtils.isNotBlank() does not yet have a nullability @Contract
87
- private ConditionEvaluationResult (boolean enabled , String reason ) {
89
+ private ConditionEvaluationResult (boolean enabled , @ Nullable String reason ) {
88
90
this .enabled = enabled ;
89
91
this .reason = StringUtils .isNotBlank (reason ) ? Optional .of (reason .strip ()) : Optional .empty ();
90
92
}
0 commit comments