use of org.springframework.boot.actuate.health.HealthContributorRegistry in project spring-boot by spring-projects.
the class AutoConfiguredHealthContributorRegistryTests method registerContributorWithGroupNameThrowsException.
@Test
void registerContributorWithGroupNameThrowsException() {
HealthContributorRegistry registry = new AutoConfiguredHealthContributorRegistry(Collections.emptyMap(), Arrays.asList("spring", "boot"));
assertThatIllegalStateException().isThrownBy(() -> registry.registerContributor("spring", mock(HealthContributor.class))).withMessage("HealthContributor with name \"spring\" clashes with group");
}
use of org.springframework.boot.actuate.health.HealthContributorRegistry in project spring-boot by spring-projects.
the class HealthEndpointAutoConfigurationTests method runCreatesHealthContributorRegistryContainingHealthBeans.
@Test
void runCreatesHealthContributorRegistryContainingHealthBeans() {
this.contextRunner.run((context) -> {
HealthContributorRegistry registry = context.getBean(HealthContributorRegistry.class);
Object[] names = registry.stream().map(NamedContributor::getName).toArray();
assertThat(names).containsExactlyInAnyOrder("simple", "additional", "ping", "reactive");
});
}
use of org.springframework.boot.actuate.health.HealthContributorRegistry in project spring-boot by spring-projects.
the class HealthEndpointAutoConfigurationTests method runWhenHasHealthContributorRegistryBeanDoesNotCreateAdditionalRegistry.
@Test
void runWhenHasHealthContributorRegistryBeanDoesNotCreateAdditionalRegistry() {
this.contextRunner.withUserConfiguration(HealthContributorRegistryConfiguration.class).run((context) -> {
HealthContributorRegistry registry = context.getBean(HealthContributorRegistry.class);
Object[] names = registry.stream().map(NamedContributor::getName).toArray();
assertThat(names).isEmpty();
});
}
use of org.springframework.boot.actuate.health.HealthContributorRegistry in project spring-boot by spring-projects.
the class HealthEndpointAutoConfigurationTests method runWhenNoReactorCreatesHealthContributorRegistryContainingHealthBeans.
@Test
void runWhenNoReactorCreatesHealthContributorRegistryContainingHealthBeans() {
ClassLoader classLoader = new FilteredClassLoader(Mono.class, Flux.class);
this.contextRunner.withClassLoader(classLoader).run((context) -> {
HealthContributorRegistry registry = context.getBean(HealthContributorRegistry.class);
Object[] names = registry.stream().map(NamedContributor::getName).toArray();
assertThat(names).containsExactlyInAnyOrder("simple", "additional", "ping");
});
}
Aggregations