Skip to content

Commit d20d626

Browse files
committed
SpringBoot2 - JUnit5 - skip test - next improvement
1 parent 3326287 commit d20d626

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

springboot2-junit5-skiptest/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -176,22 +176,22 @@ There is no way avoiding new annotation processing:
176176
public class TestEnabledCondition implements ExecutionCondition {
177177

178178
static class AnnotationDescription {
179-
String name;
180-
Boolean value;
181-
AnnotationDescription(String prefix, String property) {
182-
this.name = prefix + property;
179+
String name;
180+
Boolean annotationEnabled;
181+
AnnotationDescription(String prefix, String property) {
182+
this.name = prefix + property;
183+
}
184+
String getName() {
185+
return name;
186+
}
187+
AnnotationDescription setAnnotationEnabled(Boolean value) {
188+
this.annotationEnabled = value;
189+
return this;
190+
}
191+
Boolean isAnnotationEnabled() {
192+
return annotationEnabled;
193+
}
183194
}
184-
String getName() {
185-
return name;
186-
}
187-
AnnotationDescription setValue(Boolean value) {
188-
this.value = value;
189-
return this;
190-
}
191-
Boolean getValue() {
192-
return value;
193-
}
194-
}
195195

196196
/* ... */
197197
}
@@ -235,9 +235,9 @@ public class TestEnabledCondition implements ExecutionCondition {
235235
.map(e -> e.getAnnotation(TestEnabled.class))
236236
.map(TestEnabled::property)
237237
.map(property -> makeDescription(context, property))
238-
.map(description -> description.setValue(environment.getProperty(description.getName(), Boolean.class)))
238+
.map(description -> description.setAnnotationEnabled(environment.getProperty(description.getName(), Boolean.class)))
239239
.map(description -> {
240-
if (Boolean.TRUE.equals(description.getValue())) {
240+
if (description.isAnnotationEnabled()) {
241241
return ConditionEvaluationResult.enabled("Enabled by property: "+description.getName());
242242
} else {
243243
return ConditionEvaluationResult.disabled("Disabled by property: "+description.getName());

springboot2-junit5-skiptest/src/test/java/com/bvn13/example/springboot/junit/skiptest/TestEnabledCondition.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ public class TestEnabledCondition implements ExecutionCondition {
1515

1616
static class AnnotationDescription {
1717
String name;
18-
Boolean value;
18+
Boolean annotationEnabled;
1919
AnnotationDescription(String prefix, String property) {
2020
this.name = prefix + property;
2121
}
2222
String getName() {
2323
return name;
2424
}
25-
AnnotationDescription setValue(Boolean value) {
26-
this.value = value;
25+
AnnotationDescription setAnnotationEnabled(Boolean value) {
26+
this.annotationEnabled = value;
2727
return this;
2828
}
29-
Boolean getValue() {
30-
return value;
29+
Boolean isAnnotationEnabled() {
30+
return annotationEnabled;
3131
}
3232
}
3333

@@ -48,9 +48,9 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con
4848
.map(e -> e.getAnnotation(TestEnabled.class))
4949
.map(TestEnabled::property)
5050
.map(property -> makeDescription(context, property))
51-
.map(description -> description.setValue(environment.getProperty(description.getName(), Boolean.class)))
51+
.map(description -> description.setAnnotationEnabled(environment.getProperty(description.getName(), Boolean.class)))
5252
.map(description -> {
53-
if (Boolean.TRUE.equals(description.getValue())) {
53+
if (description.isAnnotationEnabled()) {
5454
return ConditionEvaluationResult.enabled("Enabled by property: "+description.getName());
5555
} else {
5656
return ConditionEvaluationResult.disabled("Disabled by property: "+description.getName());

0 commit comments

Comments
 (0)