Polish
This commit is contained in:
@@ -56,6 +56,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider;
|
||||
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.cache.Cache;
|
||||
@@ -73,7 +74,6 @@ import org.springframework.cache.jcache.JCacheCacheManager;
|
||||
import org.springframework.cache.support.NoOpCacheManager;
|
||||
import org.springframework.cache.support.SimpleCacheManager;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -101,8 +101,8 @@ public class CacheAutoConfigurationTests {
|
||||
@Rule
|
||||
public final ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
.standard().autoConfig(CacheAutoConfiguration.class);
|
||||
private final StandardContextLoader contextLoader = ContextLoader.standard()
|
||||
.autoConfig(CacheAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
public void noEnableCaching() {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -60,8 +60,8 @@ public class HazelcastAutoConfigurationClientTests {
|
||||
}
|
||||
}
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
.standard().autoConfig(HazelcastAutoConfiguration.class);
|
||||
private final StandardContextLoader contextLoader = ContextLoader.standard()
|
||||
.autoConfig(HazelcastAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
public void systemProperty() throws IOException {
|
||||
|
||||
@@ -28,9 +28,9 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
@@ -46,8 +46,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ClassPathExclusions("hazelcast-client-*.jar")
|
||||
public class HazelcastAutoConfigurationServerTests {
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
.standard().autoConfig(HazelcastAutoConfiguration.class);
|
||||
private final StandardContextLoader contextLoader = ContextLoader.standard()
|
||||
.autoConfig(HazelcastAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
public void defaultConfigFile() throws IOException {
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.hazelcast.core.HazelcastInstance;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
public class HazelcastAutoConfigurationTests {
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
private final StandardContextLoader contextLoader = ContextLoader
|
||||
.standard().autoConfig(HazelcastAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.boot.jdbc.DatabaseDriver;
|
||||
import org.springframework.boot.test.context.ContextConsumer;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.boot.test.context.HidePackagesClassLoader;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -58,7 +58,7 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
public class DataSourceAutoConfigurationTests {
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
private final StandardContextLoader contextLoader = ContextLoader
|
||||
.standard().autoConfig(DataSourceAutoConfiguration.class)
|
||||
.env("spring.datasource.initialize=false",
|
||||
"spring.datasource.url:jdbc:hsqldb:mem:testdb-"
|
||||
@@ -185,7 +185,7 @@ public class DataSourceAutoConfigurationTests {
|
||||
.load(testExplicitType());
|
||||
}
|
||||
|
||||
private ContextConsumer<AnnotationConfigApplicationContext> testExplicitType() {
|
||||
private ContextConsumer testExplicitType() {
|
||||
return context -> {
|
||||
assertThat(context.getBeansOfType(DataSource.class)).hasSize(1);
|
||||
DataSource bean = context.getBean(DataSource.class);
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
@@ -62,8 +62,7 @@ public class JmsAutoConfigurationTests {
|
||||
|
||||
private static final String ACTIVEMQ_NETWORK_URL = "tcp://localhost:61616";
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
.standard()
|
||||
private final StandardContextLoader contextLoader = ContextLoader.standard()
|
||||
.autoConfig(ActiveMQAutoConfiguration.class, JmsAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -42,8 +42,7 @@ import static org.mockito.Mockito.mockingDetails;
|
||||
*/
|
||||
public class ActiveMQAutoConfigurationTests {
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
.standard()
|
||||
private final StandardContextLoader contextLoader = ContextLoader.standard()
|
||||
.autoConfig(ActiveMQAutoConfiguration.class, JmsAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -43,8 +43,8 @@ import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.boot.test.context.StandardContextLoader;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
@@ -66,8 +66,7 @@ public class ArtemisAutoConfigurationTests {
|
||||
@Rule
|
||||
public final TemporaryFolder folder = new TemporaryFolder();
|
||||
|
||||
private final ContextLoader<AnnotationConfigApplicationContext> contextLoader = ContextLoader
|
||||
.standard()
|
||||
private final StandardContextLoader contextLoader = ContextLoader.standard()
|
||||
.autoConfig(ArtemisAutoConfiguration.class, JmsAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.boot.autoconfigure.web.reactive;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.boot.web.reactive.context.GenericReactiveWebApplicationContext;
|
||||
import org.springframework.boot.test.context.ReactiveWebContextLoader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.server.reactive.HttpHandler;
|
||||
@@ -39,8 +39,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
public class HttpHandlerAutoConfigurationTests {
|
||||
|
||||
private final ContextLoader<GenericReactiveWebApplicationContext> contextLoader = ContextLoader
|
||||
.reactiveWeb().autoConfig(HttpHandlerAutoConfiguration.class);
|
||||
private final ReactiveWebContextLoader contextLoader = ContextLoader.reactiveWeb()
|
||||
.autoConfig(HttpHandlerAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
public void shouldNotProcessIfExistingHttpHandler() {
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.boot.autoconfigure.validation.ValidatorAdapter;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.WelcomePageHandlerMapping;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.boot.test.context.ServletWebContextLoader;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedHttpPutFormContentFilter;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
@@ -61,7 +62,6 @@ import org.springframework.validation.Validator;
|
||||
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
||||
import org.springframework.web.accept.ContentNegotiationManager;
|
||||
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
import org.springframework.web.filter.HttpPutFormContentFilter;
|
||||
import org.springframework.web.servlet.HandlerAdapter;
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
@@ -114,8 +114,7 @@ public class WebMvcAutoConfigurationTests {
|
||||
|
||||
private static final MockServletWebServerFactory webServerFactory = new MockServletWebServerFactory();
|
||||
|
||||
private final ContextLoader<AnnotationConfigWebApplicationContext> contextLoader = ContextLoader
|
||||
.servletWeb()
|
||||
private final ServletWebContextLoader contextLoader = ContextLoader.servletWeb()
|
||||
.autoConfig(WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class)
|
||||
@@ -236,7 +235,6 @@ public class WebMvcAutoConfigurationTests {
|
||||
assertThat(resolver.getStrategyMap().get("/**/*.js"))
|
||||
.isInstanceOf(FixedVersionStrategy.class);
|
||||
});
|
||||
;
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -575,7 +573,7 @@ public class WebMvcAutoConfigurationTests {
|
||||
public void welcomePageMappingProducesNotFoundResponseWhenThereIsNoWelcomePage() {
|
||||
this.contextLoader
|
||||
.env("spring.resources.static-locations:classpath:/no-welcome-page/");
|
||||
this.contextLoader.load(context -> {
|
||||
this.contextLoader.loadWeb(context -> {
|
||||
assertThat(context.getBeansOfType(WelcomePageHandlerMapping.class))
|
||||
.hasSize(1);
|
||||
MockMvcBuilders.webAppContextSetup(context).build()
|
||||
@@ -600,7 +598,7 @@ public class WebMvcAutoConfigurationTests {
|
||||
public void welcomePageMappingHandlesRequestsThatAcceptTextHtml() {
|
||||
this.contextLoader
|
||||
.env("spring.resources.static-locations:classpath:/welcome-page/");
|
||||
this.contextLoader.load(context -> {
|
||||
this.contextLoader.loadWeb(context -> {
|
||||
assertThat(context.getBeansOfType(WelcomePageHandlerMapping.class))
|
||||
.hasSize(1);
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
|
||||
@@ -615,7 +613,7 @@ public class WebMvcAutoConfigurationTests {
|
||||
public void welcomePageMappingDoesNotHandleRequestsThatDoNotAcceptTextHtml() {
|
||||
this.contextLoader
|
||||
.env("spring.resources.static-locations:classpath:/welcome-page/");
|
||||
this.contextLoader.load(context -> {
|
||||
this.contextLoader.loadWeb(context -> {
|
||||
assertThat(context.getBeansOfType(WelcomePageHandlerMapping.class))
|
||||
.hasSize(1);
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
|
||||
@@ -628,7 +626,7 @@ public class WebMvcAutoConfigurationTests {
|
||||
public void welcomePageMappingHandlesRequestsWithNoAcceptHeader() {
|
||||
this.contextLoader
|
||||
.env("spring.resources.static-locations:classpath:/welcome-page/");
|
||||
this.contextLoader.load(context -> {
|
||||
this.contextLoader.loadWeb(context -> {
|
||||
assertThat(context.getBeansOfType(WelcomePageHandlerMapping.class))
|
||||
.hasSize(1);
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
|
||||
@@ -642,7 +640,7 @@ public class WebMvcAutoConfigurationTests {
|
||||
throws Exception {
|
||||
this.contextLoader
|
||||
.env("spring.resources.static-locations:classpath:/welcome-page/");
|
||||
this.contextLoader.load(context -> {
|
||||
this.contextLoader.loadWeb(context -> {
|
||||
assertThat(context.getBeansOfType(WelcomePageHandlerMapping.class))
|
||||
.hasSize(1);
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
|
||||
@@ -656,7 +654,7 @@ public class WebMvcAutoConfigurationTests {
|
||||
throws Exception {
|
||||
this.contextLoader
|
||||
.env("spring.resources.static-locations:classpath:/welcome-page");
|
||||
this.contextLoader.load(context -> {
|
||||
this.contextLoader.loadWeb(context -> {
|
||||
assertThat(context.getBeansOfType(WelcomePageHandlerMapping.class))
|
||||
.hasSize(1);
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
|
||||
|
||||
@@ -22,9 +22,9 @@ import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.test.context.ContextLoader;
|
||||
import org.springframework.boot.test.context.ServletWebContextLoader;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -37,8 +37,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
public class WebServicesAutoConfigurationTests {
|
||||
|
||||
private final ContextLoader<AnnotationConfigWebApplicationContext> contextLoader = ContextLoader
|
||||
.servletWeb().autoConfig(WebServicesAutoConfiguration.class);
|
||||
private final ServletWebContextLoader contextLoader = ContextLoader.servletWeb()
|
||||
.autoConfig(WebServicesAutoConfiguration.class);
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
Reference in New Issue
Block a user