diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index 79683c81dd..3e91dc5fda 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -60,9 +60,9 @@ import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.test.context.ApplicationContextRunner; -import org.springframework.boot.test.context.AssertableApplicationContext; -import org.springframework.boot.test.context.ContextConsumer; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.cassandra.core.CassandraOperations; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java index 44fba0a485..459b92a6b9 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java @@ -54,9 +54,9 @@ import org.springframework.beans.factory.BeanCreationException; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider; import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration; -import org.springframework.boot.test.context.ApplicationContextRunner; -import org.springframework.boot.test.context.AssertableApplicationContext; -import org.springframework.boot.test.context.ContextConsumer; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner; import org.springframework.cache.Cache; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java index 47c64753cc..16f94b4eac 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java @@ -29,7 +29,7 @@ import org.springframework.boot.autoconfigure.data.neo4j.city.City; import org.springframework.boot.autoconfigure.data.neo4j.country.Country; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration; -import org.springframework.boot.test.context.WebApplicationContextRunner; +import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java index d5f49f28ac..9d0b62f091 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java @@ -30,7 +30,7 @@ import org.junit.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java index c6714e5190..6ed7efea40 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java @@ -28,7 +28,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.BeanCreationException; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner; import org.springframework.context.annotation.Bean; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java index c296b73569..d3309a05d1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationTests.java @@ -23,7 +23,7 @@ import com.hazelcast.core.HazelcastInstance; import org.junit.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.core.io.ClassPathResource; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java index cc102d93d8..cc9481ca78 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java @@ -25,8 +25,8 @@ import retrofit2.Retrofit; import org.springframework.beans.DirectFieldAccessor; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.ApplicationContextRunner; -import org.springframework.boot.test.context.AssertableApplicationContext; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index 8b0e5a4188..980701425f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -39,9 +39,9 @@ import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.jdbc.DatabaseDriver; -import org.springframework.boot.test.context.ApplicationContextRunner; -import org.springframework.boot.test.context.AssertableApplicationContext; import org.springframework.boot.test.context.HidePackagesClassLoader; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java index b23769eb99..4b21f58ed5 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java @@ -28,8 +28,8 @@ import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration; -import org.springframework.boot.test.context.ApplicationContextRunner; -import org.springframework.boot.test.context.AssertableApplicationContext; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java index 4c3a492f2d..18f2e03a56 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration; -import org.springframework.boot.test.context.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java index edab68342c..bcd71ba404 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisAutoConfigurationTests.java @@ -42,7 +42,7 @@ import org.junit.rules.TemporaryFolder; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration; -import org.springframework.boot.test.context.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfigurationTests.java index 850d81570c..b00998a840 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfigurationTests.java @@ -19,7 +19,7 @@ package org.springframework.boot.autoconfigure.web.reactive; import org.junit.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.ReactiveWebApplicationContextRunner; +import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.server.reactive.HttpHandler; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java index 1bc41ca63c..6fa98743ea 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java @@ -38,9 +38,9 @@ import org.springframework.boot.autoconfigure.validation.ValidationAutoConfigura 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.AssertableWebApplicationContext; -import org.springframework.boot.test.context.ContextConsumer; -import org.springframework.boot.test.context.WebApplicationContextRunner; +import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; +import org.springframework.boot.test.context.runner.ContextConsumer; +import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor; import org.springframework.boot.web.servlet.filter.OrderedHttpPutFormContentFilter; import org.springframework.boot.web.servlet.server.ServletWebServerFactory; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfigurationTests.java index 3499665328..6eb93e150e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfigurationTests.java @@ -24,7 +24,7 @@ import org.junit.rules.ExpectedException; import org.springframework.beans.factory.BeanCreationException; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.WebApplicationContextRunner; +import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.test.util.ReflectionTestUtils; diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/TestDatabaseAutoConfigurationTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/TestDatabaseAutoConfigurationTests.java index 25562014ca..b688c00c64 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/TestDatabaseAutoConfigurationTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/TestDatabaseAutoConfigurationTests.java @@ -21,7 +21,7 @@ import javax.sql.DataSource; import org.junit.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationNoEmbeddedTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationNoEmbeddedTests.java index 2f4f9c3817..fccbb37068 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationNoEmbeddedTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfigurationNoEmbeddedTests.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.BeanCreationException; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.context.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner; import org.springframework.context.annotation.Bean; diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ApplicationContextAssert.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java similarity index 98% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/ApplicationContextAssert.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java index bc98986d13..35bf1d30d4 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ApplicationContextAssert.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractObjectArrayAssert; @@ -25,13 +25,14 @@ import org.assertj.core.api.MapAssert; import org.assertj.core.error.BasicErrorMessageFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.ApplicationContext; import org.springframework.util.Assert; import static org.assertj.core.api.Assertions.assertThat; /** - * AspectJ {@link org.assertj.core.api.Assert assertions} that can be applied to an + * AssertJ {@link org.assertj.core.api.Assert assertions} that can be applied to an * {@link ApplicationContext}. * * @param The application context type diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContext.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java similarity index 90% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContext.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java index 7ea2860d7b..00c267bc88 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContext.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import java.io.Closeable; import java.lang.reflect.Proxy; @@ -48,7 +48,7 @@ import org.springframework.util.Assert; * @see AssertableReactiveWebApplicationContext * @see ApplicationContextAssert */ -interface AssertProviderApplicationContext extends +public interface ApplicationContextAssertProvider extends ApplicationContext, AssertProvider>, Closeable { /** @@ -88,19 +88,19 @@ interface AssertProviderApplicationContext extends void close(); /** - * Factory method to create a new {@link AssertProviderApplicationContext} instance. + * Factory method to create a new {@link ApplicationContextAssertProvider} instance. * @param the assert provider type * @param the context type - * @param type the type of {@link AssertProviderApplicationContext} required (must be + * @param type the type of {@link ApplicationContextAssertProvider} required (must be * an interface) * @param contextType the type of {@link ApplicationContext} being managed (must be an * interface) * @param contextSupplier a supplier that will either return a fully configured * {@link ApplicationContext} or throw an exception if the context fails to start. - * @return a {@link AssertProviderApplicationContext} instance + * @return a {@link ApplicationContextAssertProvider} instance */ @SuppressWarnings("unchecked") - static , C extends ApplicationContext> T get( + static , C extends ApplicationContext> T get( Class type, Class contextType, Supplier contextSupplier) { Assert.notNull(type, "Type must not be null"); diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertProviderApplicationContextInvocationHandler.java similarity index 97% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertProviderApplicationContextInvocationHandler.java index 0519c7de30..67948df423 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertProviderApplicationContextInvocationHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import java.io.Closeable; import java.io.IOException; @@ -31,7 +31,7 @@ import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * {@link InvocationHandler} used by {@link AssertProviderApplicationContext} generated + * {@link InvocationHandler} used by {@link ApplicationContextAssertProvider} generated * proxies. * * @author Phillip Webb diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableApplicationContext.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableApplicationContext.java similarity index 83% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableApplicationContext.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableApplicationContext.java index 195fb222f2..9195ad50b9 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableApplicationContext.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableApplicationContext.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import java.util.function.Supplier; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; @@ -26,7 +27,7 @@ import org.springframework.context.ConfigurableApplicationContext; * be used to decorate and existing application context or an application context that * failed to start. *

- * See {@link AssertProviderApplicationContext} for more details. + * See {@link ApplicationContextAssertProvider} for more details. * * @author Phillip Webb * @since 2.0.0 @@ -34,7 +35,7 @@ import org.springframework.context.ConfigurableApplicationContext; * @see ApplicationContext */ public interface AssertableApplicationContext - extends AssertProviderApplicationContext { + extends ApplicationContextAssertProvider { /** * Factory method to create a new {@link AssertableApplicationContext} instance. @@ -45,7 +46,7 @@ public interface AssertableApplicationContext */ static AssertableApplicationContext get( Supplier contextSupplier) { - return AssertProviderApplicationContext.get(AssertableApplicationContext.class, + return ApplicationContextAssertProvider.get(AssertableApplicationContext.class, ConfigurableApplicationContext.class, contextSupplier); } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableReactiveWebApplicationContext.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableReactiveWebApplicationContext.java similarity index 89% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableReactiveWebApplicationContext.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableReactiveWebApplicationContext.java index 86e5703d4f..418cff4301 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableReactiveWebApplicationContext.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableReactiveWebApplicationContext.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import java.util.function.Supplier; @@ -26,7 +26,7 @@ import org.springframework.boot.web.reactive.context.ReactiveWebApplicationConte * assertions. Can be used to decorate and existing reactive web application context or an * application context that failed to start. *

- * See {@link AssertProviderApplicationContext} for more details. + * See {@link ApplicationContextAssertProvider} for more details. * * @author Phillip Webb * @since 2.0.0 @@ -34,7 +34,7 @@ import org.springframework.boot.web.reactive.context.ReactiveWebApplicationConte * @see ReactiveWebApplicationContext */ public interface AssertableReactiveWebApplicationContext extends - AssertProviderApplicationContext, + ApplicationContextAssertProvider, ReactiveWebApplicationContext { /** @@ -47,7 +47,7 @@ public interface AssertableReactiveWebApplicationContext extends */ static AssertableReactiveWebApplicationContext get( Supplier contextSupplier) { - return AssertProviderApplicationContext.get( + return ApplicationContextAssertProvider.get( AssertableReactiveWebApplicationContext.class, ConfigurableReactiveWebApplicationContext.class, contextSupplier); } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableWebApplicationContext.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableWebApplicationContext.java similarity index 84% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableWebApplicationContext.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableWebApplicationContext.java index b511496e4a..9778420f48 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertableWebApplicationContext.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertableWebApplicationContext.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import java.util.function.Supplier; +import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; @@ -26,7 +27,7 @@ import org.springframework.web.context.WebApplicationContext; * Can be used to decorate and existing servlet web application context or an application * context that failed to start. *

- * See {@link AssertProviderApplicationContext} for more details. + * See {@link ApplicationContextAssertProvider} for more details. * * @author Phillip Webb * @since 2.0.0 @@ -34,7 +35,7 @@ import org.springframework.web.context.WebApplicationContext; * @see WebApplicationContext */ public interface AssertableWebApplicationContext - extends AssertProviderApplicationContext, + extends ApplicationContextAssertProvider, WebApplicationContext { /** @@ -46,7 +47,7 @@ public interface AssertableWebApplicationContext */ static AssertableWebApplicationContext get( Supplier contextSupplier) { - return AssertProviderApplicationContext.get(AssertableWebApplicationContext.class, + return ApplicationContextAssertProvider.get(AssertableWebApplicationContext.class, ConfigurableWebApplicationContext.class, contextSupplier); } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/package-info.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/package-info.java new file mode 100644 index 0000000000..df4996cf1c --- /dev/null +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2017 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * AssertJ support for ApplicationContexts. + */ +package org.springframework.boot.test.context.assertj; diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AbstractApplicationContextRunner.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner.java similarity index 96% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/AbstractApplicationContextRunner.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner.java index f2423bbdcb..270beff416 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AbstractApplicationContextRunner.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; import java.util.ArrayList; import java.util.Arrays; @@ -23,6 +23,9 @@ import java.util.function.Supplier; import org.springframework.boot.context.annotation.Configurations; import org.springframework.boot.context.annotation.UserConfigurations; +import org.springframework.boot.test.context.HidePackagesClassLoader; +import org.springframework.boot.test.context.assertj.ApplicationContextAssert; +import org.springframework.boot.test.context.assertj.ApplicationContextAssertProvider; import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; @@ -92,7 +95,7 @@ import org.springframework.util.ReflectionUtils; * @see ReactiveWebApplicationContextRunner * @see ApplicationContextAssert */ -abstract class AbstractApplicationContextRunner, C extends ConfigurableApplicationContext, A extends AssertProviderApplicationContext> { +abstract class AbstractApplicationContextRunner, C extends ConfigurableApplicationContext, A extends ApplicationContextAssertProvider> { private final Supplier contextFactory; @@ -246,7 +249,7 @@ abstract class AbstractApplicationContextRunner assertType = (Class) resolvableType.resolveGeneric(1); Class contextType = (Class) resolvableType.resolveGeneric(2); - return AssertProviderApplicationContext.get(assertType, contextType, + return ApplicationContextAssertProvider.get(assertType, contextType, this::createAndLoadContext); } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ApplicationContextRunner.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ApplicationContextRunner.java similarity index 93% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/ApplicationContextRunner.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ApplicationContextRunner.java index 42650c1aad..d3799554bd 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ApplicationContextRunner.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ApplicationContextRunner.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; import java.util.function.Supplier; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ContextConsumer.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ContextConsumer.java similarity index 95% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/ContextConsumer.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ContextConsumer.java index 18052939ed..e6da8ca150 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ContextConsumer.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ContextConsumer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; import org.springframework.context.ApplicationContext; diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ReactiveWebApplicationContextRunner.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ReactiveWebApplicationContextRunner.java similarity index 93% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/ReactiveWebApplicationContextRunner.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ReactiveWebApplicationContextRunner.java index 1849ff7859..07ec6fc2fd 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ReactiveWebApplicationContextRunner.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ReactiveWebApplicationContextRunner.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; import java.util.function.Supplier; +import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext; import org.springframework.boot.web.reactive.context.ConfigurableReactiveWebApplicationContext; import org.springframework.boot.web.reactive.context.GenericReactiveWebApplicationContext; diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/WebApplicationContextRunner.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/WebApplicationContextRunner.java similarity index 95% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/WebApplicationContextRunner.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/WebApplicationContextRunner.java index 9645df427f..ea3e9b1c54 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/WebApplicationContextRunner.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/WebApplicationContextRunner.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; import java.util.function.Supplier; +import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.mock.web.MockServletContext; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/package-info.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/package-info.java new file mode 100644 index 0000000000..bd8554f0fd --- /dev/null +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2012-2017 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Test utilities to run application contexts for testing. + */ +package org.springframework.boot.test.context.runner; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertProviderApplicationContextTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java similarity index 82% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertProviderApplicationContextTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java index 3d7d8549ed..e88ff857da 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertProviderApplicationContextTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import java.util.function.Supplier; @@ -34,12 +34,12 @@ import static org.hamcrest.Matchers.equalTo; import static org.mockito.Mockito.verify; /** - * Tests for {@link AssertProviderApplicationContext} and + * Tests for {@link ApplicationContextAssertProvider} and * {@link AssertProviderApplicationContextInvocationHandler}. * * @author Phillip Webb */ -public class AssertProviderApplicationContextTests { +public class ApplicationContextAssertProviderTests { @Rule public ExpectedException thrown = ExpectedException.none(); @@ -67,7 +67,7 @@ public class AssertProviderApplicationContextTests { public void getWhenTypeIsNullShouldThrowException() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); - AssertProviderApplicationContext.get(null, ApplicationContext.class, + ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier); } @@ -75,7 +75,7 @@ public class AssertProviderApplicationContextTests { public void getWhenTypeIsClassShouldThrowException() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must not be null"); - AssertProviderApplicationContext.get(null, ApplicationContext.class, + ApplicationContextAssertProvider.get(null, ApplicationContext.class, this.mockContextSupplier); } @@ -83,7 +83,7 @@ public class AssertProviderApplicationContextTests { public void getWhenContextTypeIsNullShouldThrowException() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Type must be an interface"); - AssertProviderApplicationContext.get( + ApplicationContextAssertProvider.get( TestAssertProviderApplicationContextClass.class, ApplicationContext.class, this.mockContextSupplier); } @@ -92,7 +92,7 @@ public class AssertProviderApplicationContextTests { public void getWhenContextTypeIsClassShouldThrowException() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextType must not be null"); - AssertProviderApplicationContext.get(TestAssertProviderApplicationContext.class, + ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, null, this.mockContextSupplier); } @@ -100,14 +100,14 @@ public class AssertProviderApplicationContextTests { public void getWhenSupplierIsNullShouldThrowException() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ContextType must be an interface"); - AssertProviderApplicationContext.get(TestAssertProviderApplicationContext.class, + ApplicationContextAssertProvider.get(TestAssertProviderApplicationContext.class, StaticApplicationContext.class, this.mockContextSupplier); } @Test public void getWhenContextStartsShouldReturnProxyThatCallsRealMethods() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat((Object) context).isNotNull(); context.getBean("foo"); @@ -117,7 +117,7 @@ public class AssertProviderApplicationContextTests { @Test public void getWhenContextFailsShouldReturnProxyThatThrowsExceptions() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.startupFailureSupplier); assertThat((Object) context).isNotNull(); expectStartupFailure(); @@ -127,14 +127,14 @@ public class AssertProviderApplicationContextTests { @Test public void getSourceContextWhenContextStartsShouldReturnSourceContext() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.getSourceApplicationContext()).isSameAs(this.mockContext); } @Test public void getSourceContextWhenContextFailsShouldThrowException() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.startupFailureSupplier); expectStartupFailure(); context.getSourceApplicationContext(); @@ -143,7 +143,7 @@ public class AssertProviderApplicationContextTests { @Test public void getSourceContextOfTypeWhenContextStartsShouldReturnSourceContext() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.getSourceApplicationContext(ApplicationContext.class)) .isSameAs(this.mockContext); @@ -152,7 +152,7 @@ public class AssertProviderApplicationContextTests { @Test public void getSourceContextOfTypeWhenContextFailsToStartShouldThrowException() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.startupFailureSupplier); expectStartupFailure(); context.getSourceApplicationContext(ApplicationContext.class); @@ -160,7 +160,7 @@ public class AssertProviderApplicationContextTests { @Test public void getStartupFailureWhenContextStartsShouldReturnNull() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.getStartupFailure()).isNull(); } @@ -168,14 +168,14 @@ public class AssertProviderApplicationContextTests { @Test public void getStartupFailureWhenContextFailsToStartShouldReturnException() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.startupFailureSupplier); assertThat(context.getStartupFailure()).isEqualTo(this.startupFailure); } @Test public void assertThatWhenContextStartsShouldReturnAssertions() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.mockContextSupplier); ApplicationContextAssert contextAssert = assertThat(context); assertThat(contextAssert.getApplicationContext()).isSameAs(context); @@ -184,7 +184,7 @@ public class AssertProviderApplicationContextTests { @Test public void assertThatWhenContextFailsShouldReturnAssertions() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.startupFailureSupplier); ApplicationContextAssert contextAssert = assertThat(context); assertThat(contextAssert.getApplicationContext()).isSameAs(context); @@ -193,7 +193,7 @@ public class AssertProviderApplicationContextTests { @Test public void toStringWhenContextStartsShouldReturnSimpleString() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.mockContextSupplier); assertThat(context.toString()) .startsWith( @@ -204,7 +204,7 @@ public class AssertProviderApplicationContextTests { @Test public void toStringWhenContextFailsToStartShouldReturnSimpleString() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.startupFailureSupplier); assertThat(context.toString()).isEqualTo("Unstarted application context " + "org.springframework.context.ApplicationContext" @@ -213,7 +213,7 @@ public class AssertProviderApplicationContextTests { @Test public void closeShouldCloseContext() throws Exception { - AssertProviderApplicationContext context = get( + ApplicationContextAssertProvider context = get( this.mockContextSupplier); context.close(); verify(this.mockContext).close(); @@ -225,15 +225,15 @@ public class AssertProviderApplicationContextTests { this.thrown.expectCause(equalTo(this.startupFailure)); } - private AssertProviderApplicationContext get( + private ApplicationContextAssertProvider get( Supplier contextSupplier) { - return AssertProviderApplicationContext.get( + return ApplicationContextAssertProvider.get( TestAssertProviderApplicationContext.class, ApplicationContext.class, contextSupplier); } private interface TestAssertProviderApplicationContext - extends AssertProviderApplicationContext { + extends ApplicationContextAssertProvider { } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ApplicationContextAssertTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertTests.java similarity index 99% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/ApplicationContextAssertTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertTests.java index 798286612b..b9767bbd06 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ApplicationContextAssertTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import org.junit.Rule; import org.junit.Test; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableApplicationContextTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableApplicationContextTests.java similarity index 92% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableApplicationContextTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableApplicationContextTests.java index 9d1e4a7ca0..975bacd349 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableApplicationContextTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableApplicationContextTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import org.junit.Test; @@ -27,7 +27,7 @@ import static org.mockito.Mockito.mock; * Tests for {@link AssertableApplicationContext}. * * @author Phillip Webb - * @see AssertProviderApplicationContextTests + * @see ApplicationContextAssertProviderTests */ public class AssertableApplicationContextTests { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableReactiveWebApplicationContextTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableReactiveWebApplicationContextTests.java similarity index 92% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableReactiveWebApplicationContextTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableReactiveWebApplicationContextTests.java index 4f5b49196d..c190b43af5 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableReactiveWebApplicationContextTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableReactiveWebApplicationContextTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import org.junit.Test; @@ -27,7 +27,7 @@ import static org.mockito.Mockito.mock; * Tests for {@link AssertableReactiveWebApplicationContext}. * * @author Phillip Webb - * @see AssertProviderApplicationContextTests + * @see ApplicationContextAssertProviderTests */ public class AssertableReactiveWebApplicationContextTests { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableWebApplicationContextTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableWebApplicationContextTests.java similarity index 92% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableWebApplicationContextTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableWebApplicationContextTests.java index b49effc0a9..c88c5f0ba0 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AssertableWebApplicationContextTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/AssertableWebApplicationContextTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.assertj; import org.junit.Test; @@ -27,7 +27,7 @@ import static org.mockito.Mockito.mock; * Tests for {@link AssertableWebApplicationContext}. * * @author Phillip Webb - * @see AssertProviderApplicationContextTests + * @see ApplicationContextAssertProviderTests */ public class AssertableWebApplicationContextTests { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractApplicationContextRunnerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java similarity index 94% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractApplicationContextRunnerTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java index 73fa1508aa..835ca1576a 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractApplicationContextRunnerTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; import java.util.UUID; @@ -24,6 +24,8 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.springframework.boot.context.annotation.UserConfigurations; +import org.springframework.boot.test.context.HidePackagesClassLoader; +import org.springframework.boot.test.context.assertj.ApplicationContextAssertProvider; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -42,10 +44,10 @@ import static org.assertj.core.api.Assertions.fail; * @author Stephane Nicoll * @author Phillip Webb */ -public abstract class AbstractApplicationContextRunnerTests, C extends ConfigurableApplicationContext, A extends AssertProviderApplicationContext> { +public abstract class AbstractApplicationContextRunnerTests, C extends ConfigurableApplicationContext, A extends ApplicationContextAssertProvider> { @Rule - public final ExpectedException thrown = ExpectedException.none(); + public ExpectedException thrown = ExpectedException.none(); @Test public void runWithSystemPropertiesShouldSetAndRemoveProperties() { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ApplicationContextRunnerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/ApplicationContextRunnerTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/ApplicationContextRunnerTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/ApplicationContextRunnerTests.java index 408abf753f..fd0196f9ba 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ApplicationContextRunnerTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/ApplicationContextRunnerTests.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; import org.springframework.context.ConfigurableApplicationContext; /** diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ReactiveWebApplicationContextRunnerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/ReactiveWebApplicationContextRunnerTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/ReactiveWebApplicationContextRunnerTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/ReactiveWebApplicationContextRunnerTests.java index 7ddf7ee134..39024908d4 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ReactiveWebApplicationContextRunnerTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/ReactiveWebApplicationContextRunnerTests.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; +import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext; import org.springframework.boot.web.reactive.context.ConfigurableReactiveWebApplicationContext; /** diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/WebApplicationContextRunnerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java similarity index 91% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/WebApplicationContextRunnerTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java index 065306fc9b..b461d3070d 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/WebApplicationContextRunnerTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package org.springframework.boot.test.context; +package org.springframework.boot.test.context.runner; import org.junit.Test; +import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.mock.web.MockServletContext; import org.springframework.web.context.ConfigurableWebApplicationContext;