Use supplier assertions in availability indicator

See gh-21758
pull/21793/head
dreis2211 5 years ago committed by Phillip Webb
parent 96ae4864a2
commit eeb1db2176

@ -69,7 +69,8 @@ public class AvailabilityStateHealthIndicator extends AbstractHealthIndicator {
if (!this.statusMappings.containsKey(null) && Enum.class.isAssignableFrom(stateType)) {
EnumSet elements = EnumSet.allOf((Class) stateType);
for (Object element : elements) {
Assert.isTrue(this.statusMappings.containsKey(element), "StatusMappings does not include " + element);
Assert.isTrue(this.statusMappings.containsKey(element),
() -> "StatusMappings does not include " + element);
}
}
}
@ -81,7 +82,7 @@ public class AvailabilityStateHealthIndicator extends AbstractHealthIndicator {
if (status == null) {
status = this.statusMappings.get(null);
}
Assert.state(status != null, "No mapping provided for " + state);
Assert.state(status != null, () -> "No mapping provided for " + state);
builder.status(status);
}

Loading…
Cancel
Save