Search in sources :

Example 6 with HealthComponent

use of org.springframework.boot.actuate.health.HealthComponent in project spring-boot by spring-projects.

the class HealthEndpointAutoConfigurationTests method runCreatesReactiveHealthEndpointWebExtension.

@Test
void runCreatesReactiveHealthEndpointWebExtension() {
    this.reactiveContextRunner.run((context) -> {
        ReactiveHealthEndpointWebExtension webExtension = context.getBean(ReactiveHealthEndpointWebExtension.class);
        Mono<WebEndpointResponse<? extends HealthComponent>> response = webExtension.health(ApiVersion.V3, WebServerNamespace.SERVER, SecurityContext.NONE, true, "simple");
        Health health = (Health) (response.block().getBody());
        assertThat(health.getDetails()).containsEntry("counter", 42);
    });
}
Also used : HealthComponent(org.springframework.boot.actuate.health.HealthComponent) Health(org.springframework.boot.actuate.health.Health) WebEndpointResponse(org.springframework.boot.actuate.endpoint.web.WebEndpointResponse) ReactiveHealthEndpointWebExtension(org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)6 HealthComponent (org.springframework.boot.actuate.health.HealthComponent)6 Health (org.springframework.boot.actuate.health.Health)4 ReactiveHealthEndpointWebExtension (org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension)4 WebEndpointResponse (org.springframework.boot.actuate.endpoint.web.WebEndpointResponse)2 CompositeHealth (org.springframework.boot.actuate.health.CompositeHealth)2 HealthEndpointWebExtension (org.springframework.boot.actuate.health.HealthEndpointWebExtension)2