SpringBoot2 - JUnit5 - skip test - next improvement

master
bvn13 2019-08-24 17:12:13 +03:00
parent 3326287655
commit d20d62698d
2 changed files with 24 additions and 24 deletions

View File

@ -176,22 +176,22 @@ There is no way avoiding new annotation processing:
public class TestEnabledCondition implements ExecutionCondition { public class TestEnabledCondition implements ExecutionCondition {
static class AnnotationDescription { static class AnnotationDescription {
String name; String name;
Boolean value; Boolean annotationEnabled;
AnnotationDescription(String prefix, String property) { AnnotationDescription(String prefix, String property) {
this.name = prefix + property; this.name = prefix + property;
}
String getName() {
return name;
}
AnnotationDescription setAnnotationEnabled(Boolean value) {
this.annotationEnabled = value;
return this;
}
Boolean isAnnotationEnabled() {
return annotationEnabled;
}
} }
String getName() {
return name;
}
AnnotationDescription setValue(Boolean value) {
this.value = value;
return this;
}
Boolean getValue() {
return value;
}
}
/* ... */ /* ... */
} }
@ -235,9 +235,9 @@ public class TestEnabledCondition implements ExecutionCondition {
.map(e -> e.getAnnotation(TestEnabled.class)) .map(e -> e.getAnnotation(TestEnabled.class))
.map(TestEnabled::property) .map(TestEnabled::property)
.map(property -> makeDescription(context, property)) .map(property -> makeDescription(context, property))
.map(description -> description.setValue(environment.getProperty(description.getName(), Boolean.class))) .map(description -> description.setAnnotationEnabled(environment.getProperty(description.getName(), Boolean.class)))
.map(description -> { .map(description -> {
if (Boolean.TRUE.equals(description.getValue())) { if (description.isAnnotationEnabled()) {
return ConditionEvaluationResult.enabled("Enabled by property: "+description.getName()); return ConditionEvaluationResult.enabled("Enabled by property: "+description.getName());
} else { } else {
return ConditionEvaluationResult.disabled("Disabled by property: "+description.getName()); return ConditionEvaluationResult.disabled("Disabled by property: "+description.getName());

View File

@ -15,19 +15,19 @@ public class TestEnabledCondition implements ExecutionCondition {
static class AnnotationDescription { static class AnnotationDescription {
String name; String name;
Boolean value; Boolean annotationEnabled;
AnnotationDescription(String prefix, String property) { AnnotationDescription(String prefix, String property) {
this.name = prefix + property; this.name = prefix + property;
} }
String getName() { String getName() {
return name; return name;
} }
AnnotationDescription setValue(Boolean value) { AnnotationDescription setAnnotationEnabled(Boolean value) {
this.value = value; this.annotationEnabled = value;
return this; return this;
} }
Boolean getValue() { Boolean isAnnotationEnabled() {
return value; return annotationEnabled;
} }
} }
@ -48,9 +48,9 @@ public class TestEnabledCondition implements ExecutionCondition {
.map(e -> e.getAnnotation(TestEnabled.class)) .map(e -> e.getAnnotation(TestEnabled.class))
.map(TestEnabled::property) .map(TestEnabled::property)
.map(property -> makeDescription(context, property)) .map(property -> makeDescription(context, property))
.map(description -> description.setValue(environment.getProperty(description.getName(), Boolean.class))) .map(description -> description.setAnnotationEnabled(environment.getProperty(description.getName(), Boolean.class)))
.map(description -> { .map(description -> {
if (Boolean.TRUE.equals(description.getValue())) { if (description.isAnnotationEnabled()) {
return ConditionEvaluationResult.enabled("Enabled by property: "+description.getName()); return ConditionEvaluationResult.enabled("Enabled by property: "+description.getName());
} else { } else {
return ConditionEvaluationResult.disabled("Disabled by property: "+description.getName()); return ConditionEvaluationResult.disabled("Disabled by property: "+description.getName());