use of org.springframework.boot.test.context.FilteredClassLoader in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method jettyServerCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce.
@Test
void jettyServerCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withClassLoader(new FilteredClassLoader(Tomcat.class, HttpServer.class)).withUserConfiguration(DoubleRegistrationJettyServerCustomizerConfiguration.class, HttpHandlerConfiguration.class).withPropertyValues("server.port=0").run((context) -> {
JettyReactiveWebServerFactory factory = context.getBean(JettyReactiveWebServerFactory.class);
JettyServerCustomizer customizer = context.getBean("serverCustomizer", JettyServerCustomizer.class);
assertThat(factory.getServerCustomizers()).contains(customizer);
then(customizer).should().customize(any(Server.class));
});
}
Aggregations