use of org.springframework.boot.actuate.health.HealthEndpointWebExtension in project spring-boot by spring-projects.
the class HealthEndpointAutoConfigurationTests method runCreatesHealthEndpointWebExtension.
@Test
void runCreatesHealthEndpointWebExtension() {
this.contextRunner.run((context) -> {
HealthEndpointWebExtension webExtension = context.getBean(HealthEndpointWebExtension.class);
WebEndpointResponse<HealthComponent> response = webExtension.health(ApiVersion.V3, WebServerNamespace.SERVER, SecurityContext.NONE, true, "simple");
Health health = (Health) response.getBody();
assertThat(response.getStatus()).isEqualTo(200);
assertThat(health.getDetails()).containsEntry("counter", 42);
});
}
use of org.springframework.boot.actuate.health.HealthEndpointWebExtension in project spring-boot by spring-projects.
the class HealthEndpointAutoConfigurationTests method runWhenHasHealthEndpointWebExtensionBeanDoesNotCreateExtraHealthEndpointWebExtension.
@Test
void runWhenHasHealthEndpointWebExtensionBeanDoesNotCreateExtraHealthEndpointWebExtension() {
this.contextRunner.withUserConfiguration(HealthEndpointWebExtensionConfiguration.class).run((context) -> {
HealthEndpointWebExtension webExtension = context.getBean(HealthEndpointWebExtension.class);
WebEndpointResponse<HealthComponent> response = webExtension.health(ApiVersion.V3, WebServerNamespace.SERVER, SecurityContext.NONE, true, "simple");
assertThat(response).isNull();
});
}
Aggregations