use of org.springframework.boot.test.context.runner.ApplicationContextRunner in project spring-boot by spring-projects.
the class MetricsAutoConfigurationIntegrationTests method compositeCreatedWithMultipleRegistries.
@Test
void compositeCreatedWithMultipleRegistries() {
new ApplicationContextRunner().with(MetricsRun.limitedTo(GraphiteMetricsExportAutoConfiguration.class, JmxMetricsExportAutoConfiguration.class)).run((context) -> {
MeterRegistry registry = context.getBean(MeterRegistry.class);
assertThat(registry).isInstanceOf(CompositeMeterRegistry.class);
assertThat(((CompositeMeterRegistry) registry).getRegistries()).hasAtLeastOneElementOfType(GraphiteMeterRegistry.class).hasAtLeastOneElementOfType(JmxMeterRegistry.class);
});
}
use of org.springframework.boot.test.context.runner.ApplicationContextRunner in project spring-boot by spring-projects.
the class MetricsAutoConfigurationIntegrationTests method userConfiguredCompositeHasMeterFiltersApplied.
@Test
void userConfiguredCompositeHasMeterFiltersApplied() {
new ApplicationContextRunner().with(MetricsRun.limitedTo()).withUserConfiguration(CompositeMeterRegistryConfiguration.class).run((context) -> {
MeterRegistry composite = context.getBean(MeterRegistry.class);
assertThat(composite).extracting("filters", InstanceOfAssertFactories.ARRAY).hasSize(1);
assertThat(composite).isInstanceOf(CompositeMeterRegistry.class);
Set<MeterRegistry> registries = ((CompositeMeterRegistry) composite).getRegistries();
assertThat(registries).hasSize(2);
assertThat(registries).hasOnlyElementsOfTypes(SimpleMeterRegistry.class);
});
}
use of org.springframework.boot.test.context.runner.ApplicationContextRunner in project spring-boot by spring-projects.
the class NoDslContextBeanFailureAnalyzerTests method noAnalysisWithoutR2dbcAutoConfiguration.
@Test
void noAnalysisWithoutR2dbcAutoConfiguration() {
new ApplicationContextRunner().run((context) -> {
NoDslContextBeanFailureAnalyzer failureAnalyzer = new NoDslContextBeanFailureAnalyzer(context.getBeanFactory());
assertThat(failureAnalyzer.analyze(new NoSuchBeanDefinitionException(DSLContext.class))).isNull();
});
}
Aggregations