From b398b3319ccde41e632c83dc390869a1f6949ace Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 4 Apr 2016 21:25:01 -0700 Subject: [PATCH] Rename @SpringApplicationTest -> @SpringBootTest Rename @SpringApplicationTest to SpringBootTest and @SpringApplicationContextLoader to @SpringBootContextLoader. Fixes gh-5562 --- .../hypermedia/EndpointDocumentation.java | 4 +- .../HealthEndpointDocumentation.java | 4 +- .../HypermediaEndpointDocumentation.java | 4 +- .../EndpointMvcIntegrationTests.java | 6 +- .../mvc/EnvironmentMvcEndpointTests.java | 4 +- ...vcEndpointBrowserPathIntegrationTests.java | 4 +- ...erMvcEndpointDisabledIntegrationTests.java | 4 +- ...ointEndpointsDisabledIntegrationTests.java | 4 +- ...ManagementContextPathIntegrationTests.java | 4 +- ...ointServerContextPathIntegrationTests.java | 6 +- ...MvcEndpointServerPortIntegrationTests.java | 6 +- ...serMvcEndpointVanillaIntegrationTests.java | 4 +- .../endpoint/mvc/InfoMvcEndpointTests.java | 4 +- ...cEndpointWithoutAnyInfoProvidersTests.java | 4 +- .../JolokiaMvcEndpointContextPathTests.java | 4 +- .../endpoint/mvc/JolokiaMvcEndpointTests.java | 4 +- .../endpoint/mvc/MetricsMvcEndpointTests.java | 4 +- .../SpringIntegrationMetricReaderTests.java | 4 +- ...urceAutoConfigurationIntegrationTests.java | 4 +- ...geSourceAutoConfigurationProfileTests.java | 4 +- .../boot/autoconfigure/SpringJUnitTests.java | 4 +- ...igurationCustomFilterContextPathTests.java | 6 +- ...utoConfigurationCustomFilterPathTests.java | 6 +- ...ConfigurationCustomLoadOnStartupTests.java | 6 +- ...rationCustomObjectMapperProviderTests.java | 6 +- ...gurationCustomServletContextPathTests.java | 6 +- ...toConfigurationCustomServletPathTests.java | 6 +- ...toConfigurationDefaultFilterPathTests.java | 6 +- ...oConfigurationDefaultServletPathTests.java | 6 +- ...onfigurationObjectMapperProviderTests.java | 6 +- ...utoConfigurationServletContainerTests.java | 6 +- ...figurationWithoutApplicationPathTests.java | 6 +- ...acheAutoConfigurationIntegrationTests.java | 6 +- .../MustacheStandaloneIntegrationTests.java | 6 +- .../web/MustacheWebIntegrationTests.java | 6 +- .../security/jpa/JpaUserDetailsTests.java | 4 +- ...serInfoTokenServicesRefreshTokenTests.java | 6 +- .../sso/BasicOAuth2SsoConfigurationTests.java | 4 +- .../CustomOAuth2SsoConfigurationTests.java | 4 +- ...nticationEntryPointConfigurationTests.java | 4 +- .../BasicErrorControllerIntegrationTests.java | 6 +- .../web/BasicErrorControllerMockMvcTests.java | 4 +- .../web/DefaultErrorViewIntegrationTests.java | 4 +- .../RemappedErrorViewIntegrationTests.java | 6 +- .../HttpTunnelIntegrationTests.java | 6 +- spring-boot-docs/src/main/asciidoc/howto.adoc | 4 +- .../main/asciidoc/spring-boot-features.adoc | 18 +-- .../HelloWebSecurityApplicationTests.java | 6 +- .../sample/activemq/SampleActiveMqTests.java | 4 +- .../SampleActuatorLog4J2ApplicationTests.java | 6 +- .../SampleActuatorNoWebApplicationTests.java | 4 +- .../SampleActuatorUiApplicationPortTests.java | 6 +- .../ui/SampleActuatorUiApplicationTests.java | 6 +- ...pertiesSampleActuatorApplicationTests.java | 6 +- ...AndPathSampleActuatorApplicationTests.java | 6 +- ...agementSampleActuatorApplicationTests.java | 6 +- ...nsecureSampleActuatorApplicationTests.java | 6 +- ...gementAddressActuatorApplicationTests.java | 6 +- ...entPathSampleActuatorApplicationTests.java | 6 +- ...AndPathSampleActuatorApplicationTests.java | 6 +- ...entPortSampleActuatorApplicationTests.java | 6 +- ...agementSampleActuatorApplicationTests.java | 6 +- .../actuator/NonSensitiveHealthTests.java | 6 +- .../SampleActuatorApplicationTests.java | 6 +- ...nsecureSampleActuatorApplicationTests.java | 6 +- ...letPathSampleActuatorApplicationTests.java | 6 +- ...hutdownSampleActuatorApplicationTests.java | 6 +- .../SampleAtmosphereApplicationTests.java | 6 +- .../cache/SampleCacheApplicationTests.java | 4 +- .../SampleCassandraApplicationTests.java | 4 +- .../SampleDataGemFireApplicationTests.java | 4 +- .../jpa/SampleDataJpaApplicationTests.java | 4 +- .../CityRepositoryIntegrationTests.java | 4 +- .../HotelRepositoryIntegrationTests.java | 4 +- .../mongo/SampleMongoApplicationTests.java | 4 +- .../rest/SampleDataRestApplicationTests.java | 4 +- .../CityRepositoryIntegrationTests.java | 4 +- .../flyway/SampleFlywayApplicationTests.java | 4 +- .../SampleHateoasApplicationTests.java | 6 +- .../SampleHypermediaGsonApplicationTests.java | 4 +- ...ermediaJpaApplicationIntegrationTests.java | 4 +- .../SampleHypermediaJpaApplicationTests.java | 4 +- .../SampleHypermediaUiApplicationTests.java | 6 +- ...pleHypermediaApplicationHomePageTests.java | 6 +- .../jersey/SampleJerseyApplicationTests.java | 6 +- .../SampleJersey1ApplicationTests.java | 6 +- .../ssl/SampleJettySslApplicationTests.java | 6 +- .../jetty/SampleJettyApplicationTests.java | 6 +- .../ssl/SampleJetty8SslApplicationTests.java | 6 +- .../jetty8/SampleJetty8ApplicationTests.java | 6 +- .../SampleJetty93ApplicationTests.java | 6 +- .../sample/jpa/SampleJpaApplicationTests.java | 4 +- .../JpaNoteRepositoryIntegrationTests.java | 4 +- .../JpaTagRepositoryIntegrationTests.java | 4 +- ...mpleDropwizardMetricsApplicationTests.java | 6 +- .../SampleOpenTsdbExportApplicationTests.java | 6 +- .../SampleRedisExportApplicationTests.java | 6 +- ...eSecureOAuth2ResourceApplicationTests.java | 6 +- .../SampleSecureOAuth2ApplicationTests.java | 6 +- .../secure/SampleSecureApplicationTests.java | 4 +- .../SampleServletApplicationTests.java | 6 +- ...pringTestSampleSimpleApplicationTests.java | 4 +- ...pleTestApplicationWebIntegrationTests.java | 6 +- ...UserVehicleControllerApplicationTests.java | 4 +- .../testng/SampleTestNGApplicationTests.java | 6 +- .../jsp/SampleWebJspApplicationTests.java | 6 +- ...leTomcatTwoConnectorsApplicationTests.java | 6 +- .../ssl/SampleTomcatSslApplicationTests.java | 6 +- ...igurationSampleTomcatApplicationTests.java | 6 +- .../tomcat/SampleTomcatApplicationTests.java | 6 +- .../jsp/SampleWebJspApplicationTests.java | 6 +- .../SampleTraditionalApplicationTests.java | 6 +- .../SampleUndertowSslApplicationTests.java | 6 +- .../SampleUndertowApplicationTests.java | 6 +- .../SampleVelocityApplicationTests.java | 4 +- .../SampleWebFreeMarkerApplicationTests.java | 6 +- .../MessageControllerWebTests.java | 4 +- .../SampleGroovyTemplateApplicationTests.java | 6 +- .../jsp/SampleWebJspApplicationTests.java | 6 +- .../SampleMethodSecurityApplicationTests.java | 6 +- .../SampleWebMustacheApplicationTests.java | 6 +- ...SampleWebSecureCustomApplicationTests.java | 6 +- .../github/SampleGithubApplicationTests.java | 6 +- ...SampleWebSecureCustomApplicationTests.java | 6 +- .../secure/SampleSecureApplicationTests.java | 6 +- .../SampleWebStaticApplicationTests.java | 6 +- .../web/ui/SampleWebUiApplicationTests.java | 6 +- .../SampleWebVelocityApplicationTests.java | 6 +- .../SampleWebSocketsApplicationTests.java | 6 +- ...omContainerWebSocketsApplicationTests.java | 6 +- .../SampleWebSocketsApplicationTests.java | 6 +- ...omContainerWebSocketsApplicationTests.java | 6 +- .../SampleWebSocketsApplicationTests.java | 6 +- ...omContainerWebSocketsApplicationTests.java | 6 +- .../sample/ws/SampleWsApplicationTests.java | 6 +- .../autoconfigure/orm/jpa/DataJpaTest.java | 4 +- .../autoconfigure/web/servlet/WebMvcTest.java | 4 +- ...SpringApplicationTestIntegrationTests.java | 6 +- .../boot/test/IntegrationTest.java | 4 +- .../test/SpringApplicationConfiguration.java | 14 +- .../test/SpringApplicationContextLoader.java | 8 +- .../boot/test/WebIntegrationTest.java | 2 +- ...ingApplicationTestContextBootstrapper.java | 120 ----------------- ...ader.java => SpringBootContextLoader.java} | 10 +- ...plicationTest.java => SpringBootTest.java} | 11 +- .../SpringBootTestContextBootstrapper.java | 121 +++++++++++++++++- ...a => SpringBootTestContextCustomizer.java} | 8 +- ...ringBootTestContextCustomizerFactory.java} | 10 +- .../main/resources/META-INF/spring.factories | 2 +- ...gBootTestEmbeddedWebEnvironmentTests.java} | 4 +- ... SpringBootContextLoaderMockMvcTests.java} | 4 +- ...java => SpringBootContextLoaderTests.java} | 18 +-- ... => SpringBootTestActiveProfileTests.java} | 6 +- ...ingBootTestDefaultConfigurationTests.java} | 4 +- ...ringBootTestGroovyConfigurationTests.java} | 6 +- ...stGroovyConventionConfigurationTests.java} | 6 +- ...Tests.java => SpringBootTestJmxTests.java} | 4 +- ...pringBootTestMixedConfigurationTests.java} | 8 +- ... SpringBootTestPropertyLocationTests.java} | 8 +- ...otTestWebEnvironmentDefinedPortTests.java} | 10 +- ...pringBootTestWebEnvironmentMockTests.java} | 8 +- ...ootTestWebEnvironmentRandomPortTests.java} | 10 +- ...gBootTestWithClassesIntegrationTests.java} | 6 +- ...ContextConfigurationIntegrationTests.java} | 8 +- ...tTestXmlConventionConfigurationTests.java} | 6 +- .../SpringBootMockServletContextTests.java | 4 +- ...onventionConfigurationTestsContext.groovy} | 0 ...lConventionConfigurationTests-context.xml} | 0 168 files changed, 579 insertions(+), 591 deletions(-) delete mode 100644 spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextBootstrapper.java rename spring-boot-test/src/main/java/org/springframework/boot/test/context/{SpringApplicationContextLoader.java => SpringBootContextLoader.java} (97%) rename spring-boot-test/src/main/java/org/springframework/boot/test/context/{SpringApplicationTest.java => SpringBootTest.java} (94%) rename spring-boot-test/src/main/java/org/springframework/boot/test/context/{SpringApplicationTestContextCustomizer.java => SpringBootTestContextCustomizer.java} (88%) rename spring-boot-test/src/main/java/org/springframework/boot/test/context/{SpringApplicationTestContextCustomizerFactory.java => SpringBootTestContextCustomizerFactory.java} (79%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{AbstractSpringApplicationTestWebEnvironmentEmbeddedTests.java => AbstractSpringBootTestEmbeddedWebEnvironmentTests.java} (95%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationContextLoaderMockMvcTests.java => SpringBootContextLoaderMockMvcTests.java} (95%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationContextLoaderTests.java => SpringBootContextLoaderTests.java} (88%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestActiveProfileTests.java => SpringBootTestActiveProfileTests.java} (88%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestDefaultConfigurationTests.java => SpringBootTestDefaultConfigurationTests.java} (90%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestGroovyConfigurationTests.java => SpringBootTestGroovyConfigurationTests.java} (88%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestGroovyConventionConfigurationTests.java => SpringBootTestGroovyConventionConfigurationTests.java} (88%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestJmxTests.java => SpringBootTestJmxTests.java} (95%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestMixedConfigurationTests.java => SpringBootTestMixedConfigurationTests.java} (86%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestPropertyLocationTests.java => SpringBootTestPropertyLocationTests.java} (88%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestWebEnvironmentDefinedPortTests.java => SpringBootTestWebEnvironmentDefinedPortTests.java} (78%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestWebEnvironmentMockTests.java => SpringBootTestWebEnvironmentMockTests.java} (90%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestWebEnvironmentRandomPortTests.java => SpringBootTestWebEnvironmentRandomPortTests.java} (78%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestWithClassesIntegrationTests.java => SpringBootTestWithClassesIntegrationTests.java} (88%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestWithContextConfigurationIntegrationTests.java => SpringBootTestWithContextConfigurationIntegrationTests.java} (85%) rename spring-boot-test/src/test/java/org/springframework/boot/test/context/{SpringApplicationTestXmlConventionConfigurationTests.java => SpringBootTestXmlConventionConfigurationTests.java} (88%) rename spring-boot-test/src/test/resources/org/springframework/boot/test/context/{SpringApplicationTestGroovyConventionConfigurationTestsContext.groovy => SpringBootTestGroovyConventionConfigurationTestsContext.groovy} (100%) rename spring-boot-test/src/test/resources/org/springframework/boot/test/context/{SpringApplicationTestXmlConventionConfigurationTests-context.xml => SpringBootTestXmlConventionConfigurationTests-context.xml} (100%) diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java index 0d99592eea..25f03fb427 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java @@ -36,7 +36,7 @@ import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint; import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringApplicationContextLoader; +import org.springframework.boot.test.context.SpringBootContextLoader; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; @@ -54,7 +54,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringApplicationContextLoader.class) +@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringBootContextLoader.class) @WebAppConfiguration @TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true", "endpoints.health.sensitive=true", "endpoints.actuator.enabled=false" }) diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java index 06520312d2..7847aa4427 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HealthEndpointDocumentation.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringApplicationContextLoader; +import org.springframework.boot.test.context.SpringBootContextLoader; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; @@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringApplicationContextLoader.class) +@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringBootContextLoader.class) @WebAppConfiguration @TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true", "endpoints.health.sensitive=false" }) diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java index 9ea5fc6681..4c2b7a43e7 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/HypermediaEndpointDocumentation.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringApplicationContextLoader; +import org.springframework.boot.test.context.SpringBootContextLoader; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; @@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringApplicationContextLoader.class) +@ContextConfiguration(classes = SpringBootHypermediaApplication.class, loader = SpringBootContextLoader.class) @WebAppConfiguration @TestPropertySource(properties = "spring.jackson.serialization.indent_output=true") @DirtiesContext diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java index ba526d6d27..55837441a7 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java @@ -48,8 +48,8 @@ import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -71,7 +71,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class EndpointMvcIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java index 08a5d53d8e..5b91e61886 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java @@ -30,7 +30,7 @@ import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; @@ -56,7 +56,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext public class EnvironmentMvcEndpointTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java index 5192b959fe..73265902f5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointBrowserPathIntegrationTests.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; @@ -45,7 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = "endpoints.actuator.path=/actuator") @DirtiesContext public class HalBrowserMvcEndpointBrowserPathIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java index 275eddb12c..0188770198 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java @@ -23,7 +23,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; @@ -46,7 +46,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext public class HalBrowserMvcEndpointDisabledIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointEndpointsDisabledIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointEndpointsDisabledIntegrationTests.java index f667688896..ee237c8952 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointEndpointsDisabledIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointEndpointsDisabledIntegrationTests.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; @@ -43,7 +43,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = "endpoints.enabled=false") @DirtiesContext public class HalBrowserMvcEndpointEndpointsDisabledIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java index f77d9c99e9..b6aa7390a2 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointManagementContextPathIntegrationTests.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.hateoas.ResourceSupport; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; @@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = "management.contextPath:/admin") @DirtiesContext public class HalBrowserMvcEndpointManagementContextPathIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java index 55e33f0e59..f73c6af1e7 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java @@ -23,8 +23,8 @@ import org.junit.runner.RunWith; import org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.hateoas.ResourceSupport; import org.springframework.http.HttpEntity; @@ -49,7 +49,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "server.contextPath=/spring" }) @DirtiesContext public class HalBrowserMvcEndpointServerContextPathIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java index 23af13b903..4c4666139a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerPortIntegrationTests.java @@ -23,8 +23,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.hateoas.ResourceSupport; import org.springframework.http.HttpEntity; @@ -49,7 +49,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.port=0" }) @DirtiesContext public class HalBrowserMvcEndpointServerPortIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java index fe9a028360..184acd81a0 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java @@ -26,7 +26,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; @@ -50,7 +50,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext @TestPropertySource(properties = "endpoints.hypermedia.enabled=true") public class HalBrowserMvcEndpointVanillaIntegrationTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java index d6e8a02050..3921715372 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java @@ -33,7 +33,7 @@ import org.springframework.boot.actuate.info.InfoContributor; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -55,7 +55,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Stephane Nicoll */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = { "info.app.name=MyService" }) public class InfoMvcEndpointTests { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointWithoutAnyInfoProvidersTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointWithoutAnyInfoProvidersTests.java index 8874b65d64..c19c2e7d96 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointWithoutAnyInfoProvidersTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointWithoutAnyInfoProvidersTests.java @@ -30,7 +30,7 @@ import org.springframework.boot.actuate.info.InfoContributor; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Meang Akira Tanaka */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class InfoMvcEndpointWithoutAnyInfoProvidersTests { @Autowired diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java index aa3bb103d3..085e36ecee 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointContextPathTests.java @@ -29,7 +29,7 @@ import org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpointContextPa import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; @@ -53,7 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @ContextConfiguration(classes = { Config.class }, initializers = ContextPathListener.class) @DirtiesContext diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java index c7b0e902e4..2eed780f5e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpointTests.java @@ -29,7 +29,7 @@ import org.springframework.boot.actuate.autoconfigure.ManagementServerProperties import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Configuration; @@ -55,7 +55,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest public class JolokiaMvcEndpointTests { @Autowired diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java index c88dc80f9e..2bf65e88b5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java @@ -33,7 +33,7 @@ import org.springframework.boot.actuate.metrics.Metric; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -57,7 +57,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest public class MetricsMvcEndpointTests { @Autowired diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReaderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReaderTests.java index 547f1063f8..12d4c2279c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReaderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReaderTests.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest("spring.jmx.enabled=true") +@SpringBootTest("spring.jmx.enabled=true") @DirtiesContext public class SpringIntegrationMetricReaderTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java index 3230c299be..07a9380190 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationIntegrationTests.java @@ -22,7 +22,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest("spring.messages.basename:test/messages") +@SpringBootTest("spring.messages.basename:test/messages") @ImportAutoConfiguration({ MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) @DirtiesContext diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java index 01ab042aa6..dbd77e3b0e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfigurationProfileTests.java @@ -22,7 +22,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @ImportAutoConfiguration({ MessageSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) @ActiveProfiles("switch-messages") diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/SpringJUnitTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/SpringJUnitTests.java index 0acde6a3b7..b1fb48c9d0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/SpringJUnitTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/SpringJUnitTests.java @@ -21,7 +21,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest public class SpringJUnitTests { @Autowired diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterContextPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterContextPathTests.java index 04929dd9a6..16a717662e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterContextPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterContextPathTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.jersey.type=filter", "server.contextPath=/app" }) @DirtiesContext public class JerseyAutoConfigurationCustomFilterContextPathTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterPathTests.java index b64890b0f8..8d468c2a92 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterPathTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.type=filter") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.type=filter") @DirtiesContext public class JerseyAutoConfigurationCustomFilterPathTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomLoadOnStartupTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomLoadOnStartupTests.java index be95f47e7c..ef2aa7baf7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomLoadOnStartupTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomLoadOnStartupTests.java @@ -31,8 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Stephane Nicoll */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.servlet.load-on-startup=5") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.servlet.load-on-startup=5") @DirtiesContext public class JerseyAutoConfigurationCustomLoadOnStartupTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomObjectMapperProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomObjectMapperProviderTests.java index b58fe1f91d..5959918455 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomObjectMapperProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomObjectMapperProviderTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Eddú Meléndez */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jackson.serialization-inclusion=non_null") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jackson.serialization-inclusion=non_null") @DirtiesContext public class JerseyAutoConfigurationCustomObjectMapperProviderTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletContextPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletContextPathTests.java index 69e3a5555d..1edd097e8d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletContextPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletContextPathTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -55,7 +55,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "server.contextPath=/app") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "server.contextPath=/app") @DirtiesContext public class JerseyAutoConfigurationCustomServletContextPathTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletPathTests.java index a5a360eb52..4590cd463c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletPathTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -55,7 +55,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class JerseyAutoConfigurationCustomServletPathTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java index aff8fcc190..34787ce8ed 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java @@ -35,8 +35,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.type=filter") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.type=filter") @DirtiesContext public class JerseyAutoConfigurationDefaultFilterPathTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java index 73eff1ec76..762c38665c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java @@ -35,8 +35,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class JerseyAutoConfigurationDefaultServletPathTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationObjectMapperProviderTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationObjectMapperProviderTests.java index 3184e85def..078f8a2e43 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationObjectMapperProviderTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationObjectMapperProviderTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Eddú Meléndez */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class JerseyAutoConfigurationObjectMapperProviderTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java index 41900e1249..6b1931b844 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java @@ -34,8 +34,8 @@ import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationServ import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.rule.OutputCapture; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class JerseyAutoConfigurationServletContainerTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationWithoutApplicationPathTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationWithoutApplicationPathTests.java index 951802c52d..dbfae0dbcf 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationWithoutApplicationPathTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationWithoutApplicationPathTests.java @@ -35,8 +35,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Eddú Meléndez */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.application-path=/api") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jersey.application-path=/api") @DirtiesContext public class JerseyAutoConfigurationWithoutApplicationPathTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java index 4807806063..1b9ae16467 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java @@ -35,8 +35,8 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.mustache.prefix:classpath:/mustache-templates/" }) public class MustacheAutoConfigurationIntegrationTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java index 6472fc05ad..a3b9ac2b60 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java @@ -24,8 +24,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.test.annotation.DirtiesContext; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(webEnvironment = WebEnvironment.NONE, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.NONE, properties = { "env.foo=There", "foo=World" }) public class MustacheStandaloneIntegrationTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java index 4affb5ff40..b1a3784b79 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java @@ -40,8 +40,8 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -61,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class MustacheWebIntegrationTests { @Autowired diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java index 49476b9bd0..d06d6fdff6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java @@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfigurati import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration; import org.springframework.boot.autoconfigure.security.user.SecurityConfig; -import org.springframework.boot.test.context.SpringApplicationContextLoader; +import org.springframework.boot.test.context.SpringBootContextLoader; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; import org.springframework.test.annotation.DirtiesContext; @@ -42,7 +42,7 @@ import org.springframework.test.context.junit4.SpringRunner; * @author Dave Syer */ @RunWith(SpringRunner.class) -@ContextConfiguration(classes = JpaUserDetailsTests.Main.class, loader = SpringApplicationContextLoader.class) +@ContextConfiguration(classes = JpaUserDetailsTests.Main.class, loader = SpringBootContextLoader.class) @DirtiesContext public class JpaUserDetailsTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesRefreshTokenTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesRefreshTokenTests.java index 49f711dfdf..a4183a0082 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesRefreshTokenTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesRefreshTokenTests.java @@ -31,8 +31,8 @@ import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfi import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "security.oauth2.resource.userInfoUri:http://example.com", "security.oauth2.client.clientId=foo" }) @DirtiesContext diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/BasicOAuth2SsoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/BasicOAuth2SsoConfigurationTests.java index 0fd2443cd8..3f6bdfbdf3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/BasicOAuth2SsoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/BasicOAuth2SsoConfigurationTests.java @@ -26,7 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.test.annotation.DirtiesContext; @@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = { "security.oauth2.client.clientId=client", "security.oauth2.client.clientSecret=secret", "security.oauth2.client.authorizationUri=http://example.com/oauth/authorize", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoConfigurationTests.java index 9aea79affb..7b5988bcf8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoConfigurationTests.java @@ -26,7 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -53,7 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = { "security.oauth2.client.clientId=client", "security.oauth2.client.clientSecret=secret", "security.oauth2.client.authorizationUri=http://example.com/oauth/authorize", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoWithAuthenticationEntryPointConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoWithAuthenticationEntryPointConfigurationTests.java index a95d018e4e..91630c0c52 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoWithAuthenticationEntryPointConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/sso/CustomOAuth2SsoWithAuthenticationEntryPointConfigurationTests.java @@ -26,7 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; @@ -55,7 +55,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = { "security.oauth2.client.clientId=client", "security.oauth2.client.clientSecret=secret", "security.oauth2.client.authorizationUri=http://example.com/oauth/authorize", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java index a42d39e5e6..ccf982b2ad 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java @@ -33,8 +33,8 @@ import org.junit.runner.RunWith; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.web.BasicErrorControllerMockMvcTests.MinimalWebConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; @@ -66,7 +66,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class BasicErrorControllerIntegrationTests { private ConfigurableApplicationContext context; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java index bd5abe61b1..031460be0f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerMockMvcTests.java @@ -35,7 +35,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -66,7 +66,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext public class BasicErrorControllerMockMvcTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java index d652a93415..7559dfea28 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewIntegrationTests.java @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.MediaType; @@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext public class DefaultErrorViewIntegrationTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java index 075e231555..d272f902af 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java @@ -25,8 +25,8 @@ import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletCont import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.ErrorPage; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "server.servletPath:/spring/*") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "server.servletPath:/spring/*") @DirtiesContext public class RemappedErrorViewIntegrationTests { diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java index 06313ee344..2dea54063c 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java @@ -39,8 +39,8 @@ import org.springframework.boot.devtools.tunnel.server.PortProvider; import org.springframework.boot.devtools.tunnel.server.SocketTargetServerConnection; import org.springframework.boot.devtools.tunnel.server.StaticPortProvider; import org.springframework.boot.devtools.tunnel.server.TargetServerConnection; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class HttpTunnelIntegrationTests { @Autowired diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index 3e08e8a5e9..aadb95d71a 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -543,14 +543,14 @@ that and be sure that it has initialized is to add a `@Bean` of type `ApplicationListener` and pull the container out of the event when it is published. -Tests that use `@SpringApplicationTest(webEnvironment=WebEnvironment.RANDOM_PORT)` can +Tests that use `@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)` can also inject the actual port into a field using the `@LocalServerPort` annotation. For example: [source,java,indent=0,subs="verbatim,quotes,attributes"] ---- @RunWith(SpringJUnit4ClassRunner.class) - @SpringApplicationTest(webEnvironment=WebEnvironment.RANDOM_PORT) + @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) public class MyWebIntegrationTests { @Autowired diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 21dee932c9..72b0eee357 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -4349,12 +4349,12 @@ One thing to watch out for though is that the external properties, logging and o features of Spring Boot are only installed in the context by default if you use `SpringApplication` to create it. -Spring Boot provides a `@SpringApplicationTest` annotation which can be used as an +Spring Boot provides a `@SpringBootTest` annotation which can be used as an alternative the standard `spring-test` `@ContextConfiguration` annotation when you need Spring Boot features. The annotation works by creating the `ApplicationContext` used in your tests via `SpringApplication`. -You can use the `webEnvironment` attribute of `@SpringApplicationTest` to further refine +You can use the `webEnvironment` attribute of `@SpringBootTest` to further refine how your tests will run: * `MOCK` -- Loads a `WebApplicationContext` and provides a mock servlet environment. @@ -4370,7 +4370,7 @@ how your tests will run: * `NONE` -- Loads an `ApplicationContext` using `SpringApplication` but does not provides _any_ servlet environment (mock or otherwise). -NOTE: In addition to `@SpringApplicationTest` a number of other annotations are also +NOTE: In addition to `@SpringBootTest` a number of other annotations are also provided for testing more specific slices of an application. See below for details. TIP: Don't forget to also add `@RunWith(SpringRunner.class)` to your test, otherwise @@ -4424,7 +4424,7 @@ will need to register the `TypeExcludeFilter` with it. See [[boot-features-testing-spring-boot-applications-working-with-random-ports]] ==== Working with random ports If you need to start a full running server for tests, we recommend that you use random -ports. If you use `@SpringApplicationTest(webEnvironment=WebEnvironment.RANDOM_PORT)` +ports. If you use `@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)` an available port will be picked at random each time your test runs. The `@LocalServerPort` annotation can be used to @@ -4443,7 +4443,7 @@ For convenience, tests that need to make REST calls to the started server can ad import static org.assertj.core.api.Assertions.* @RunWith(SpringRunner.class) - @SpringApplicationTest(webEnvironment=WebEnvironment.RANDOM_PORT) + @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) public class MyWebIntegrationTests { @Autowired @@ -4490,7 +4490,7 @@ implementation: import static org.mockito.BDDMockito.*; @RunWith(SpringRunner.class) - @SpringApplicationTest + @SpringBootTest public class MyTests { @MockBean @@ -4528,7 +4528,7 @@ more `@AutoConfigure...` annotations that can be used to customize auto-configur settings. TIP: It's also possible to use the `@AutoConfigure...` annotations with the standard -`@SpringApplicationTest` annotation. You can use this combination if you're not interested +`@SpringBootTest` annotation. You can use this combination if you're not interested in '`slicing`' your application but you want some of the auto-configured test beans. @@ -4830,7 +4830,7 @@ Spring's test framework into Spock. NOTE: The annotations <> can be used with Spock, i.e. you can annotate your `Specification` with -`@SpringApplicationTest` to suit the needs of your tests. +`@SpringBootTest` to suit the needs of your tests. @@ -4845,7 +4845,7 @@ useful when testing your application. ==== ConfigFileApplicationContextInitializer `ConfigFileApplicationContextInitializer` is an `ApplicationContextInitializer` that can apply to your tests to load Spring Boot `application.properties` files. You can use -this when you don't need the full features provided by `@SpringApplicationTest`. +this when you don't need the full features provided by `@SpringBootTest`. [source,java,indent=0] ---- diff --git a/spring-boot-integration-tests/spring-boot-security-tests/spring-boot-security-test-web-helloworld/src/test/java/sample/HelloWebSecurityApplicationTests.java b/spring-boot-integration-tests/spring-boot-security-tests/spring-boot-security-test-web-helloworld/src/test/java/sample/HelloWebSecurityApplicationTests.java index 394d2baf63..681953ad4a 100644 --- a/spring-boot-integration-tests/spring-boot-security-tests/spring-boot-security-test-web-helloworld/src/test/java/sample/HelloWebSecurityApplicationTests.java +++ b/spring-boot-integration-tests/spring-boot-security-tests/spring-boot-security-test-web-helloworld/src/test/java/sample/HelloWebSecurityApplicationTests.java @@ -23,8 +23,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -35,7 +35,7 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class HelloWebSecurityApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java b/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java index 868c8bfc2e..9d437b5510 100644 --- a/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java +++ b/spring-boot-samples/spring-boot-sample-activemq/src/test/java/sample/activemq/SampleActiveMqTests.java @@ -23,7 +23,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.rule.OutputCapture; import org.springframework.test.context.junit4.SpringRunner; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Eddú Meléndez */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class SampleActiveMqTests { @Rule diff --git a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorLog4J2ApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorLog4J2ApplicationTests.java index 81399e8342..3d46b50886 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorLog4J2ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorLog4J2ApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleActuatorLog4J2ApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/noweb/SampleActuatorNoWebApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/noweb/SampleActuatorNoWebApplicationTests.java index 058096b7e0..5bba7e412a 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/noweb/SampleActuatorNoWebApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/noweb/SampleActuatorNoWebApplicationTests.java @@ -21,7 +21,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.endpoint.MetricsEndpoint; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext public class SampleActuatorNoWebApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java index 44b488e2ba..8aac3b0052 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java @@ -23,8 +23,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.port:0" }) @DirtiesContext public class SampleActuatorUiApplicationPortTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java index a9562b347e..a100ec73bf 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java @@ -23,8 +23,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleActuatorUiApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java index 453166f0c5..c11179040f 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext @ActiveProfiles("endpoints") public class EndpointsPropertiesSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java index eeec119dec..74943a5b4b 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java @@ -25,8 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.port=0", "management.context-path=/admin", "management.security.enabled=false" }) @DirtiesContext diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementSampleActuatorApplicationTests.java index 19d40c6350..9a1757f8b1 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementSampleActuatorApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.security.enabled:false" }) @DirtiesContext @ActiveProfiles("unsecure-management") diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureSampleActuatorApplicationTests.java index 5df3e819fe..a71ccec459 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureSampleActuatorApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "security.basic.enabled:false" }) @DirtiesContext public class InsecureSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java index 7f494ae066..dd733a61d0 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java @@ -23,8 +23,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.port=0", "management.address=127.0.0.1", "management.context-path:/admin" }) @DirtiesContext diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java index 6f8065bb19..d81401b1a3 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.context_path=/admin" }) @DirtiesContext public class ManagementPathSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java index 2dd7a908c6..de2bf93a56 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java @@ -25,8 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.port=0", "management.context-path=/admin" }) @DirtiesContext public class ManagementPortAndPathSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java index c4169ecc0b..6cca76961e 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java @@ -25,8 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.port=0" }) @DirtiesContext public class ManagementPortSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java index 1aada07374..c955ce768d 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.port=-1" }) @DirtiesContext public class NoManagementSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java index b361b53aac..9d915f6079 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "endpoints.health.sensitive=false" }) @DirtiesContext public class NonSensitiveHealthTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java index 640da701e1..dc4e1e3cbf 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java @@ -27,8 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Stephane Nicoll */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathInsecureSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathInsecureSampleActuatorApplicationTests.java index f97e42f1cf..2f89bf240c 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathInsecureSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathInsecureSampleActuatorApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "security.basic.enabled:false", "server.servletPath:/spring" }) @DirtiesContext public class ServletPathInsecureSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java index 0b905b625f..e06150d78f 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "server.servletPath=/spring" }) @DirtiesContext public class ServletPathSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java index 4514010467..36c0ec1ec8 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class ShutdownSampleActuatorApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java index 26d0aba05d..0de7ee35c5 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java @@ -30,8 +30,8 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -46,7 +46,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = SampleAtmosphereApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = SampleAtmosphereApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleAtmosphereApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-cache/src/test/java/sample/cache/SampleCacheApplicationTests.java b/spring-boot-samples/spring-boot-sample-cache/src/test/java/sample/cache/SampleCacheApplicationTests.java index 413d81be59..7e04246839 100644 --- a/spring-boot-samples/spring-boot-sample-cache/src/test/java/sample/cache/SampleCacheApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-cache/src/test/java/sample/cache/SampleCacheApplicationTests.java @@ -20,7 +20,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.test.context.junit4.SpringRunner; @@ -28,7 +28,7 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class SampleCacheApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java index aea5bcf090..527ecf0052 100644 --- a/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-cassandra/src/test/java/sample/data/cassandra/SampleCassandraApplicationTests.java @@ -22,7 +22,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.rule.OutputCapture; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.TestExecutionListeners.MergeMode; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) @TestExecutionListeners(mergeMode = MergeMode.MERGE_WITH_DEFAULTS, listeners = { OrderedCassandraTestExecutionListener.class }) -@SpringApplicationTest("spring.data.cassandra.port=9142") +@SpringBootTest("spring.data.cassandra.port=9142") @CassandraDataSet(keyspace = "mykeyspace", value = "setup.cql") @EmbeddedCassandra(timeout = 60000) public class SampleCassandraApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java index 0f61ac29de..bf1f2e3252 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java @@ -26,7 +26,7 @@ import sample.data.gemfire.service.GemstoneService; import sample.data.gemfire.service.GemstoneServiceImpl.IllegalGemstoneException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author John Blum */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class SampleDataGemFireApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java index 8eb840095b..7a4cef040b 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/SampleDataJpaApplicationTests.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; @@ -45,7 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest // Enable JMX so we can test the MBeans (you can't do this in a properties file) @TestPropertySource(properties = { "spring.jmx.enabled:true", "spring.datasource.jmx-enabled:true" }) diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java index 64432bde2c..1e492c9572 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java @@ -20,7 +20,7 @@ import org.junit.runner.RunWith; import sample.data.jpa.domain.City; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.test.context.junit4.SpringRunner; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Oliver Gierke */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class CityRepositoryIntegrationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java index 3a5e111e34..ead0f9955e 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java @@ -26,7 +26,7 @@ import sample.data.jpa.domain.Rating; import sample.data.jpa.domain.RatingCount; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort.Direction; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Oliver Gierke */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class HotelRepositoryIntegrationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java index 8b79dfecf2..f090004612 100644 --- a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java @@ -20,7 +20,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.rule.OutputCapture; import org.springframework.test.context.junit4.SpringRunner; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class SampleMongoApplicationTests { @ClassRule diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java index bfa88755f6..81b77b5d89 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @@ -43,7 +43,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @ActiveProfiles("scratch") // Separate profile for web tests to avoid clashing databases public class SampleDataRestApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java index 2c3570aa23..0dfc3361c3 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java @@ -21,7 +21,7 @@ import org.junit.runner.RunWith; import sample.data.rest.domain.City; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.test.context.junit4.SpringRunner; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class CityRepositoryIntegrationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java index 6c36d94168..2c3a09e0fc 100644 --- a/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-flyway/src/test/java/sample/flyway/SampleFlywayApplicationTests.java @@ -20,14 +20,14 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class SampleFlywayApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java index f6e12149f2..dcac188c4f 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SampleHateoasApplicationTests { @LocalServerPort diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java index 14d6f10f7d..ef4702e13b 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; @@ -34,7 +34,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @TestPropertySource(properties = "endpoints.hypermedia.enabled: true") public class SampleHypermediaGsonApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java index 881f33f2b0..aad26d99c6 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationIntegrationTests.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext public class SampleHypermediaJpaApplicationIntegrationTests { diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java index bd06cf02bf..cf414c8519 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java @@ -19,12 +19,12 @@ package sample.hypermedia.jpa; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @WebAppConfiguration public class SampleHypermediaJpaApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java index 9f3e34ee22..a891ee3af1 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java @@ -23,8 +23,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "management.context-path=" }) public class SampleHypermediaUiApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java b/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java index f7b8799a55..f443cf1eac 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java @@ -23,8 +23,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SampleHypermediaApplicationHomePageTests { @LocalServerPort diff --git a/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java index e1a64351e7..f9a55b47bc 100644 --- a/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -31,7 +31,7 @@ import org.springframework.web.client.RestTemplate; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SampleJerseyApplicationTests { @LocalServerPort diff --git a/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java index 15d652d418..53979b98ce 100644 --- a/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java @@ -20,15 +20,15 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SampleJersey1ApplicationTests { @LocalServerPort diff --git a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java index 9eacbf20c5..465b919251 100644 --- a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java @@ -25,8 +25,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleJettySslApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java index 0eb311a5eb..003da2d13b 100644 --- a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleJettyApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java index 90d30dcea1..8c2e834e12 100644 --- a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java @@ -25,8 +25,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleJetty8SslApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java index 3fe03f08c6..589e56ca7b 100644 --- a/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleJetty8ApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java index fdda6caff2..afde20a6d2 100644 --- a/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleJetty93ApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/SampleJpaApplicationTests.java b/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/SampleJpaApplicationTests.java index bad68f776f..6660fe3a43 100644 --- a/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/SampleJpaApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/SampleJpaApplicationTests.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; @@ -39,7 +39,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @WebAppConfiguration public class SampleJpaApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaNoteRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaNoteRepositoryIntegrationTests.java index ca37f991f2..4259baa847 100644 --- a/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaNoteRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaNoteRepositoryIntegrationTests.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import sample.jpa.domain.Note; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class JpaNoteRepositoryIntegrationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaTagRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaTagRepositoryIntegrationTests.java index 3cfccfa333..3c6f66cc87 100644 --- a/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaTagRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-jpa/src/test/java/sample/jpa/repository/JpaTagRepositoryIntegrationTests.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import sample.jpa.domain.Tag; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class JpaTagRepositoryIntegrationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/test/java/sample/metrics/dropwizard/SampleDropwizardMetricsApplicationTests.java b/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/test/java/sample/metrics/dropwizard/SampleDropwizardMetricsApplicationTests.java index 8c1700559c..1e5e02e53c 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/test/java/sample/metrics/dropwizard/SampleDropwizardMetricsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/test/java/sample/metrics/dropwizard/SampleDropwizardMetricsApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.metrics.GaugeService; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleDropwizardMetricsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/test/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplicationTests.java b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/test/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplicationTests.java index c172e94546..83591718db 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/test/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/test/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplicationTests.java @@ -19,8 +19,8 @@ package sample.metrics.opentsdb; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -30,7 +30,7 @@ import org.springframework.test.context.junit4.SpringRunner; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleOpenTsdbExportApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-metrics-redis/src/test/java/sample/metrics/redis/SampleRedisExportApplicationTests.java b/spring-boot-samples/spring-boot-sample-metrics-redis/src/test/java/sample/metrics/redis/SampleRedisExportApplicationTests.java index 7052f4ac70..c8bd9c4952 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-redis/src/test/java/sample/metrics/redis/SampleRedisExportApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-metrics-redis/src/test/java/sample/metrics/redis/SampleRedisExportApplicationTests.java @@ -19,8 +19,8 @@ package sample.metrics.redis; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -30,7 +30,7 @@ import org.springframework.test.context.junit4.SpringRunner; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jmx.enabled=true") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jmx.enabled=true") @DirtiesContext public class SampleRedisExportApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java index bcc7ea62c0..1ea8fb2e9d 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java @@ -21,8 +21,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.hateoas.MediaTypes; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.FilterChainProxy; @@ -42,7 +42,7 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppC * @author Greg Turnquist */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SampleSecureOAuth2ResourceApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java index 1455a8b8d9..5711879c1c 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.hateoas.MediaTypes; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.codec.Base64; @@ -50,7 +50,7 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppC * @author Greg Turnquist */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SampleSecureOAuth2ApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java index 7bd274edd7..a5b6c50081 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java @@ -23,7 +23,7 @@ import org.junit.runner.RunWith; import sample.secure.SampleSecureApplicationTests.TestConfiguration; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = { SampleSecureApplication.class, +@SpringBootTest(classes = { SampleSecureApplication.class, TestConfiguration.class }) public class SampleSecureApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java index 5db955175f..5aee8f5d57 100644 --- a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleServletApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java b/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java index 1cbbd45292..cd41c4f52f 100644 --- a/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SpringTestSampleSimpleApplicationTests.java @@ -20,7 +20,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.test.context.junit4.SpringRunner; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class SpringTestSampleSimpleApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/SampleTestApplicationWebIntegrationTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/SampleTestApplicationWebIntegrationTests.java index 8f0d0ec2dc..6c40515820 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/SampleTestApplicationWebIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/SampleTestApplicationWebIntegrationTests.java @@ -25,8 +25,8 @@ import sample.test.service.VehicleDetailsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestDatabase; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.test.context.junit4.SpringRunner; @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureTestDatabase public class SampleTestApplicationWebIntegrationTests { diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java index 68ed522676..77540a9b62 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java @@ -24,7 +24,7 @@ import sample.test.service.VehicleDetails; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ApplicationContext; import org.springframework.http.MediaType; @@ -43,7 +43,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @AutoConfigureMockMvc @AutoConfigureTestDatabase public class UserVehicleControllerApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java index bdd81a6387..830342564d 100644 --- a/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java @@ -19,8 +19,8 @@ package sample.testng; import org.testng.annotations.Test; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Phillip Webb */ -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleTestNGApplicationTests extends AbstractTestNGSpringContextTests { diff --git a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java index 7451211c7b..3143bf860d 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebJspApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java index 6974cef02d..9a9718a7aa 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java @@ -32,8 +32,8 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleTomcatTwoConnectorsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java index f1b1291097..4cb139e584 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java @@ -25,8 +25,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -37,7 +37,7 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleTomcatSslApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index 6141942b6b..a21399e8a5 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -29,8 +29,8 @@ import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfi import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class NonAutoConfigurationSampleTomcatApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java index 5cce794944..c6c5b01090 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleTomcatApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java index 60344a6d56..223d236cf7 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebJspApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java index 3b4f889e6f..fc9cf00ec0 100644 --- a/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleTraditionalApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java index 2bb50e3fd5..a05b0af135 100644 --- a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java @@ -25,8 +25,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Ivan Sopov */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleUndertowSslApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java index a86c7dd345..262cda4bcd 100644 --- a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleUndertowApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-velocity/src/test/java/sample/velocity/SampleVelocityApplicationTests.java b/spring-boot-samples/spring-boot-sample-velocity/src/test/java/sample/velocity/SampleVelocityApplicationTests.java index 5392ab68b3..3f6d109e2a 100644 --- a/spring-boot-samples/spring-boot-sample-velocity/src/test/java/sample/velocity/SampleVelocityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-velocity/src/test/java/sample/velocity/SampleVelocityApplicationTests.java @@ -20,7 +20,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.rule.OutputCapture; import org.springframework.test.context.junit4.SpringRunner; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest public class SampleVelocityApplicationTests { @ClassRule diff --git a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java index dc8e961bae..f0558d187d 100644 --- a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebFreeMarkerApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java index 06393abe0b..ff6726214e 100755 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @@ -46,7 +46,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Doo-Hwan, Kwak */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext public class MessageControllerWebTests { diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java index 7b6d2725ea..5f87aab27d 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleGroovyTemplateApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java index 0cb9d6cbc8..0cdd0f8ce8 100644 --- a/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebJspApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java index 1d1d928dc6..26bd0216de 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleMethodSecurityApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java index a9d10e94f6..7b2cb8d56c 100644 --- a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebMustacheApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java index 16b57e0372..9153e1ce09 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebSecureCustomApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java index 63c4f9c925..18d08f3841 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleGithubApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java index d41dc72ae1..f71d6782c7 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebSecureCustomApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java index eb95dc032b..fb090fb7d2 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleSecureApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java index f58ec11415..fd9d86d005 100644 --- a/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebStaticApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java index 9df1383d04..daa7388f9b 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebUiApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java index 0910f28f39..cece0866e7 100644 --- a/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java @@ -22,8 +22,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebVelocityApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java index 24e799b5f5..f1ef449e45 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java @@ -33,8 +33,8 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -46,7 +46,7 @@ import org.springframework.web.socket.client.standard.StandardWebSocketClient; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = SampleJettyWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = SampleJettyWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebSocketsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java index d05ebdbeb4..d37cd59e2c 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -50,7 +50,7 @@ import org.springframework.web.socket.client.standard.StandardWebSocketClient; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = { SampleJettyWebSocketsApplication.class, +@SpringBootTest(classes = { SampleJettyWebSocketsApplication.class, CustomContainerConfiguration.class }, webEnvironment = WebEnvironment.DEFINED_PORT) @DirtiesContext public class CustomContainerWebSocketsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java index 11b608c029..6b4ed87b34 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java @@ -33,8 +33,8 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -46,7 +46,7 @@ import org.springframework.web.socket.client.standard.StandardWebSocketClient; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = SampleTomcatWebSocketApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = SampleTomcatWebSocketApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebSocketsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java index c4cf4a6a10..bf46eb74ea 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -50,7 +50,7 @@ import org.springframework.web.socket.client.standard.StandardWebSocketClient; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = { SampleTomcatWebSocketApplication.class, +@SpringBootTest(classes = { SampleTomcatWebSocketApplication.class, CustomContainerConfiguration.class }, webEnvironment = WebEnvironment.DEFINED_PORT) @DirtiesContext public class CustomContainerWebSocketsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java index bea6068a28..a63e975331 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java @@ -33,8 +33,8 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -46,7 +46,7 @@ import org.springframework.web.socket.client.standard.StandardWebSocketClient; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = SampleUndertowWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = SampleUndertowWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class SampleWebSocketsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java index 1226a1391f..647b75985c 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java @@ -36,8 +36,8 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -50,7 +50,7 @@ import org.springframework.web.socket.client.standard.StandardWebSocketClient; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(classes = { SampleUndertowWebSocketsApplication.class, +@SpringBootTest(classes = { SampleUndertowWebSocketsApplication.class, CustomContainerConfiguration.class }, webEnvironment = WebEnvironment.DEFINED_PORT) @DirtiesContext public class CustomContainerWebSocketsApplicationTests { diff --git a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java index 807b172dc9..fd62339da8 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java @@ -27,8 +27,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.context.web.LocalServerPort; -import org.springframework.boot.test.context.SpringApplicationTest; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.rule.OutputCapture; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.ws.client.core.WebServiceTemplate; @@ -36,7 +36,7 @@ import org.springframework.ws.client.core.WebServiceTemplate; import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SampleWsApplicationTests { @Rule diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java index e10fd09118..6684c7bcaa 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java @@ -27,7 +27,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters; import org.springframework.boot.test.autoconfigure.properties.PropertyMapping; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTestContextBootstrapper; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.test.context.BootstrapWith; @@ -47,7 +47,7 @@ import org.springframework.transaction.annotation.Transactional; * override these settings. *

* If you are looking to load your full application configuration, but use an embedded - * database, you should consider {@link SpringApplicationTest @SpringApplicationTest} + * database, you should consider {@link SpringBootTest @SpringApplicationTest} * combined with {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} rather than * this annotation. * diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java index 69963e3f40..52ab607f91 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java @@ -26,7 +26,7 @@ import java.lang.annotation.Target; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.Import; @@ -55,7 +55,7 @@ import org.springframework.test.web.servlet.MockMvc; * beans. *

* If you are looking to load your full application configuration and use MockMVC, you - * should consider {@link SpringApplicationTest @SpringApplicationTest} combined with + * should consider {@link SpringBootTest @SpringBootTest} combined with * {@link AutoConfigureMockMvc @AutoConfigureMockMvc} rather than this annotation. * * @author Phillip Webb diff --git a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSpringApplicationTestIntegrationTests.java b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSpringApplicationTestIntegrationTests.java index 87175beca1..8f00cb1209 100644 --- a/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSpringApplicationTestIntegrationTests.java +++ b/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSpringApplicationTestIntegrationTests.java @@ -20,7 +20,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ApplicationContext; import org.springframework.test.context.junit4.SpringRunner; @@ -32,13 +32,13 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** - * Tests for {@link SpringApplicationTest} with {@link AutoConfigureMockMvc} (i.e. full + * Tests for {@link SpringBootTest} with {@link AutoConfigureMockMvc} (i.e. full * integration test). * * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @AutoConfigureMockMvc(alwaysPrint = false) public class MockMvcSpringApplicationTestIntegrationTests { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java b/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java index 600c65dc27..9e1484a24d 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java @@ -23,7 +23,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.core.env.Environment; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener; @@ -41,7 +41,7 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi * * @author Dave Syer * @see WebIntegrationTest - * @deprecated since 1.4.0 in favor of {@link SpringApplicationTest} + * @deprecated since 1.4.0 in favor of {@link SpringBootTest} */ @Documented @Inherited diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java index 409ec648cb..7d0547b2f5 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java @@ -23,8 +23,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.springframework.boot.test.context.SpringApplicationContextLoader; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootContextLoader; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.annotation.AliasFor; @@ -35,16 +35,16 @@ import org.springframework.test.context.ContextConfiguration; * {@code ApplicationContext} for integration tests. *

* Similar to the standard {@link ContextConfiguration @ContextConfiguration} but uses - * Spring Boot's {@link SpringApplicationContextLoader}. + * Spring Boot's {@link SpringBootContextLoader}. * * @author Dave Syer * @author Sam Brannen - * @see SpringApplicationContextLoader + * @see SpringBootContextLoader * @see ContextConfiguration - * @deprecated since 1.4.0 in favor of {@link SpringApplicationTest} or direct use of - * {@link SpringApplicationContextLoader}. + * @deprecated since 1.4.0 in favor of {@link SpringBootTest} or direct use of + * {@link SpringBootContextLoader}. */ -@ContextConfiguration(loader = SpringApplicationContextLoader.class) +@ContextConfiguration(loader = SpringBootContextLoader.class) @Documented @Inherited @Retention(RetentionPolicy.RUNTIME) diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java index a244d6d7c3..73c0e3495a 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java @@ -29,7 +29,7 @@ import java.util.Set; import org.springframework.beans.BeanUtils; import org.springframework.boot.SpringApplication; import org.springframework.boot.context.web.ServletContextApplicationContextInitializer; -import org.springframework.boot.test.context.SpringApplicationTest; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; @@ -67,12 +67,12 @@ import org.springframework.web.context.support.GenericWebApplicationContext; * @author Dave Syer * @author Phillip Webb * @author Andy Wilkinson - * @see org.springframework.boot.test.context.SpringApplicationTest + * @see org.springframework.boot.test.context.SpringBootTest * @see org.springframework.boot.test.IntegrationTest * @see org.springframework.boot.test.WebIntegrationTest * @deprecated since 1.4.0 in favor of - * {@link SpringApplicationTest @SpringApplicationTest} - * {@link org.springframework.boot.test.context.SpringApplicationContextLoader} can also + * {@link SpringBootTest @SpringApplicationTest} + * {@link org.springframework.boot.test.context.SpringBootContextLoader} can also * be considered if absolutely necessary. */ @Deprecated diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java b/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java index 2bc345ee5a..aa3cb01b27 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java @@ -40,7 +40,7 @@ import org.springframework.test.context.BootstrapWith; * @since 1.2.1 * @see IntegrationTest * @deprecated since 1.4.0 in favor of - * {@link org.springframework.boot.test.context.SpringApplicationTest} with + * {@link org.springframework.boot.test.context.SpringBootTest} with * {@code webEnvironment=RANDOM_PORT} or {@code webEnvironment=DEFINED_PORT}. */ @Documented diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextBootstrapper.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextBootstrapper.java deleted file mode 100644 index a94a974e41..0000000000 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextBootstrapper.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2012-2016 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. - */ - -package org.springframework.boot.test.context; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.test.context.ContextConfigurationAttributes; -import org.springframework.test.context.ContextLoader; -import org.springframework.test.context.MergedContextConfiguration; -import org.springframework.test.context.TestContext; -import org.springframework.test.context.TestContextBootstrapper; -import org.springframework.test.context.web.WebMergedContextConfiguration; -import org.springframework.util.ClassUtils; -import org.springframework.util.ObjectUtils; - -/** - * {@link TestContextBootstrapper} for {@link SpringApplicationTest}. - * - * @author Phillip Webb - */ -class SpringApplicationTestContextBootstrapper extends SpringBootTestContextBootstrapper { - - private static final String[] WEB_ENVIRONMENT_CLASSES = { "javax.servlet.Servlet", - "org.springframework.web.context.ConfigurableWebApplicationContext" }; - - private static final String ACTIVATE_SERVLET_LISTENER = "org.springframework.test." - + "context.web.ServletTestExecutionListener.activateListener"; - - @Override - public TestContext buildTestContext() { - TestContext context = super.buildTestContext(); - SpringApplicationTest annotation = AnnotatedElementUtils - .getMergedAnnotation(context.getTestClass(), SpringApplicationTest.class); - WebEnvironment webEnvironment = annotation.webEnvironment(); - if (webEnvironment == WebEnvironment.MOCK) { - context.setAttribute(ACTIVATE_SERVLET_LISTENER, true); - } - else if (webEnvironment.isEmbedded()) { - context.setAttribute(ACTIVATE_SERVLET_LISTENER, false); - } - return context; - } - - @Override - protected ContextLoader resolveContextLoader(Class testClass, - List configAttributesList) { - SpringApplicationTest annotation = AnnotatedElementUtils - .getMergedAnnotation(testClass, SpringApplicationTest.class); - if (!ObjectUtils.isEmpty(annotation.classes())) { - for (ContextConfigurationAttributes configAttributes : configAttributesList) { - addConfigAttriubtesClasses(configAttributes, annotation.classes()); - } - } - return super.resolveContextLoader(testClass, configAttributesList); - } - - private void addConfigAttriubtesClasses( - ContextConfigurationAttributes configAttributes, Class[] classes) { - List> combined = new ArrayList>(); - combined.addAll(Arrays.asList(classes)); - if (configAttributes.getClasses() != null) { - combined.addAll(Arrays.asList(configAttributes.getClasses())); - } - configAttributes.setClasses(combined.toArray(new Class[combined.size()])); - } - - @Override - protected MergedContextConfiguration processMergedContextConfiguration( - MergedContextConfiguration mergedConfig) { - mergedConfig = super.processMergedContextConfiguration(mergedConfig); - SpringApplicationTest annotation = AnnotatedElementUtils.getMergedAnnotation( - mergedConfig.getTestClass(), SpringApplicationTest.class); - WebEnvironment webEnvironment = annotation.webEnvironment(); - if (webEnvironment.isEmbedded() || (webEnvironment == WebEnvironment.MOCK - && hasWebEnvironmentClasses())) { - mergedConfig = new WebMergedContextConfiguration(mergedConfig, ""); - } - return mergedConfig; - } - - private boolean hasWebEnvironmentClasses() { - for (String className : WEB_ENVIRONMENT_CLASSES) { - if (!ClassUtils.isPresent(className, null)) { - return false; - } - } - return true; - } - - @Override - protected void processPropertySourceProperties( - MergedContextConfiguration mergedConfig, - List propertySourceProperties) { - SpringApplicationTest annotation = AnnotatedElementUtils.getMergedAnnotation( - mergedConfig.getTestClass(), SpringApplicationTest.class); - propertySourceProperties.addAll(Arrays.asList(annotation.properties())); - if (annotation.webEnvironment() == WebEnvironment.RANDOM_PORT) { - propertySourceProperties.add("server.port=0"); - } - } - -} diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationContextLoader.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java similarity index 97% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationContextLoader.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java index 47b95e945a..6b685be7b6 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationContextLoader.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java @@ -54,7 +54,7 @@ import org.springframework.web.context.support.GenericWebApplicationContext; /** * A {@link ContextLoader} that can be used to test Spring Boot applications (those that * normally startup using {@link SpringApplication}). Although this loader can be used - * directly, most test will instead want to use it with {@link SpringApplicationTest}. + * directly, most test will instead want to use it with {@link SpringBootTest}. *

* The loader supports both standard {@link MergedContextConfiguration} as well as * {@link WebMergedContextConfiguration}. If {@link WebMergedContextConfiguration} is used @@ -67,9 +67,9 @@ import org.springframework.web.context.support.GenericWebApplicationContext; * @author Dave Syer * @author Phillip Webb * @author Andy Wilkinson - * @see SpringApplicationTest + * @see SpringBootTest */ -public class SpringApplicationContextLoader extends AbstractContextLoader { +public class SpringBootContextLoader extends AbstractContextLoader { private static final Set INTEGRATION_TEST_ANNOTATIONS; @@ -182,8 +182,8 @@ public class SpringApplicationContextLoader extends AbstractContextLoader { return true; } } - SpringApplicationTest annotation = AnnotatedElementUtils - .findMergedAnnotation(config.getTestClass(), SpringApplicationTest.class); + SpringBootTest annotation = AnnotatedElementUtils + .findMergedAnnotation(config.getTestClass(), SpringBootTest.class); if (annotation != null && annotation.webEnvironment().isEmbedded()) { return true; } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTest.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTest.java similarity index 94% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTest.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTest.java index 1749a4ef5d..8ce1ae86c3 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTest.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTest.java @@ -41,10 +41,9 @@ import org.springframework.web.context.WebApplicationContext; * Provides the following features over and above the regular * Spring TestContext Framework: *

    - *
  • Uses {@link SpringApplicationContextLoader} as the default {@link ContextLoader} - * when no specific - * {@link ContextConfiguration#loader() @ContextConfiguration(loader=...)} is defined. - *
  • + *
  • Uses {@link SpringBootContextLoader} as the default {@link ContextLoader} when no + * specific {@link ContextConfiguration#loader() @ContextConfiguration(loader=...)} is + * defined.
  • *
  • Automatically searches for a * {@link SpringBootConfiguration @SpringBootConfiguration} when nested * {@code @Configuration} is not used, and no explicit {@link #classes() classes} are @@ -66,8 +65,8 @@ import org.springframework.web.context.WebApplicationContext; @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited -@BootstrapWith(SpringApplicationTestContextBootstrapper.class) -public @interface SpringApplicationTest { +@BootstrapWith(SpringBootTestContextBootstrapper.class) +public @interface SpringBootTest { /** * Alias for {@link #properties()}. diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java index 8a5aea3263..baf6d24d66 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java @@ -24,30 +24,89 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.core.annotation.AnnotatedElementUtils; +import org.springframework.core.env.Environment; +import org.springframework.test.context.ContextConfigurationAttributes; import org.springframework.test.context.ContextLoader; import org.springframework.test.context.MergedContextConfiguration; +import org.springframework.test.context.TestContext; import org.springframework.test.context.TestContextBootstrapper; import org.springframework.test.context.support.DefaultTestContextBootstrapper; +import org.springframework.test.context.web.WebMergedContextConfiguration; import org.springframework.util.Assert; +import org.springframework.util.ClassUtils; +import org.springframework.util.ObjectUtils; /** - * {@link TestContextBootstrapper} that uses {@link SpringApplicationContextLoader} and - * can automatically find the {@link SpringBootConfiguration @SpringBootConfiguration}. + * {@link TestContextBootstrapper} for Spring Boot. Provides support for + * {@link SpringBootTest @SpringBootTest} and may also be used directly or subclassed. + * Provides the following features over and above {@link DefaultTestContextBootstrapper}: + *
      + *
    • Uses {@link SpringBootContextLoader} as the + * {@link #getDefaultContextLoaderClass(Class) default context loader}.
    • + *
    • Automatically searches for a + * {@link SpringBootConfiguration @SpringBootConfiguration} when required.
    • + *
    • Allows custom {@link Environment} {@link #getProperties(Class)} to be defined.
    • + *
    • Provides support for different {@link WebEnvironment webEnvironment} modes.
    • + *
    * * @author Phillip Webb + * @author Andy Wilkinson * @since 1.4.0 + * @see SpringBootTest * @see TestConfiguration */ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstrapper { + private static final String[] WEB_ENVIRONMENT_CLASSES = { "javax.servlet.Servlet", + "org.springframework.web.context.ConfigurableWebApplicationContext" }; + + private static final String ACTIVATE_SERVLET_LISTENER = "org.springframework.test." + + "context.web.ServletTestExecutionListener.activateListener"; + private static final Log logger = LogFactory .getLog(SpringBootTestContextBootstrapper.class); + @Override + public TestContext buildTestContext() { + TestContext context = super.buildTestContext(); + WebEnvironment webEnvironment = getWebEnvironment(context.getTestClass()); + if (webEnvironment == WebEnvironment.MOCK && hasWebEnvironmentClasses()) { + context.setAttribute(ACTIVATE_SERVLET_LISTENER, true); + } + else if (webEnvironment != null && webEnvironment.isEmbedded()) { + context.setAttribute(ACTIVATE_SERVLET_LISTENER, false); + } + return context; + } + + @Override + protected ContextLoader resolveContextLoader(Class testClass, + List configAttributesList) { + Class[] classes = getClasses(testClass); + if (!ObjectUtils.isEmpty(classes)) { + for (ContextConfigurationAttributes configAttributes : configAttributesList) { + addConfigAttriubtesClasses(configAttributes, classes); + } + } + return super.resolveContextLoader(testClass, configAttributesList); + } + + private void addConfigAttriubtesClasses( + ContextConfigurationAttributes configAttributes, Class[] classes) { + List> combined = new ArrayList>(); + combined.addAll(Arrays.asList(classes)); + if (configAttributes.getClasses() != null) { + combined.addAll(Arrays.asList(configAttributes.getClasses())); + } + configAttributes.setClasses(combined.toArray(new Class[combined.size()])); + } + @Override protected Class getDefaultContextLoaderClass( Class testClass) { - return SpringApplicationContextLoader.class; + return SpringBootContextLoader.class; } @Override @@ -56,8 +115,26 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr Class[] classes = getOrFindConfigurationClasses(mergedConfig); List propertySourceProperties = getAndProcessPropertySourceProperties( mergedConfig); - return createModifiedConfig(mergedConfig, classes, propertySourceProperties - .toArray(new String[propertySourceProperties.size()])); + mergedConfig = createModifiedConfig(mergedConfig, classes, + propertySourceProperties + .toArray(new String[propertySourceProperties.size()])); + WebEnvironment webEnvironment = getWebEnvironment(mergedConfig.getTestClass()); + if (webEnvironment != null) { + if (webEnvironment.isEmbedded() || (webEnvironment == WebEnvironment.MOCK + && hasWebEnvironmentClasses())) { + mergedConfig = new WebMergedContextConfiguration(mergedConfig, ""); + } + } + return mergedConfig; + } + + private boolean hasWebEnvironmentClasses() { + for (String className : WEB_ENVIRONMENT_CLASSES) { + if (!ClassUtils.isPresent(className, null)) { + return false; + } + } + return true; } protected Class[] getOrFindConfigurationClasses( @@ -71,7 +148,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr .findFromClass(mergedConfig.getTestClass()); Assert.state(found != null, "Unable to find a @SpringBootConfiguration, you need to use " - + "@ContextConfiguration or @SpringApplicationConfiguration " + + "@ContextConfiguration or @SpringBootTest(classes=...) " + "with your test"); logger.info("Found @SpringBootConfiguration " + found.getName() + " for test " + mergedConfig.getTestClass()); @@ -126,6 +203,38 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr protected void processPropertySourceProperties( MergedContextConfiguration mergedConfig, List propertySourceProperties) { + Class testClass = mergedConfig.getTestClass(); + String[] properties = getProperties(testClass); + if (!ObjectUtils.isEmpty(properties)) { + propertySourceProperties.addAll(Arrays.asList(properties)); + } + if (getWebEnvironment(testClass) == WebEnvironment.RANDOM_PORT) { + propertySourceProperties.add("server.port=0"); + } + } + + /** + * Return the {@link WebEnvironment} type for this test or null if undefined. + * @param testClass the source test class + * @return the {@link WebEnvironment} or {@code null} + */ + protected WebEnvironment getWebEnvironment(Class testClass) { + SpringBootTest annotation = getAnnotation(testClass); + return (annotation == null ? null : annotation.webEnvironment()); + } + + protected Class[] getClasses(Class testClass) { + SpringBootTest annotation = getAnnotation(testClass); + return (annotation == null ? null : annotation.classes()); + } + + protected String[] getProperties(Class testClass) { + SpringBootTest annotation = getAnnotation(testClass); + return (annotation == null ? null : annotation.properties()); + } + + protected SpringBootTest getAnnotation(Class testClass) { + return AnnotatedElementUtils.getMergedAnnotation(testClass, SpringBootTest.class); } /** diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextCustomizer.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizer.java similarity index 88% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextCustomizer.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizer.java index 9a28c86993..d351a812b9 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextCustomizer.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizer.java @@ -26,18 +26,18 @@ import org.springframework.test.context.MergedContextConfiguration; import org.springframework.web.client.RestTemplate; /** - * {@link ContextCustomizer} for {@link SpringApplicationTest}. + * {@link ContextCustomizer} for {@link SpringBootTest}. * * @author Phillip Webb * @author Andy Wilkinson */ -class SpringApplicationTestContextCustomizer implements ContextCustomizer { +class SpringBootTestContextCustomizer implements ContextCustomizer { @Override public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedContextConfiguration) { - SpringApplicationTest annotation = AnnotatedElementUtils.getMergedAnnotation( - mergedContextConfiguration.getTestClass(), SpringApplicationTest.class); + SpringBootTest annotation = AnnotatedElementUtils.getMergedAnnotation( + mergedContextConfiguration.getTestClass(), SpringBootTest.class); if (annotation.webEnvironment().isEmbedded()) { RestTemplate restTemplate = TestRestTemplateFactory .createRestTemplate(context.getEnvironment()); diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextCustomizerFactory.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizerFactory.java similarity index 79% rename from spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextCustomizerFactory.java rename to spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizerFactory.java index 2607925af0..646c3796f2 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringApplicationTestContextCustomizerFactory.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizerFactory.java @@ -24,19 +24,19 @@ import org.springframework.test.context.ContextCustomizer; import org.springframework.test.context.ContextCustomizerFactory; /** - * {@link ContextCustomizerFactory} for {@link SpringApplicationTest}. + * {@link ContextCustomizerFactory} for {@link SpringBootTest}. * * @author Andy Wilkinson - * @see SpringApplicationTestContextCustomizer + * @see SpringBootTestContextCustomizer */ -class SpringApplicationTestContextCustomizerFactory implements ContextCustomizerFactory { +class SpringBootTestContextCustomizerFactory implements ContextCustomizerFactory { @Override public ContextCustomizer createContextCustomizer(Class testClass, List configAttributes) { if (AnnotatedElementUtils.findMergedAnnotation(testClass, - SpringApplicationTest.class) != null) { - return new SpringApplicationTestContextCustomizer(); + SpringBootTest.class) != null) { + return new SpringBootTestContextCustomizer(); } return null; } diff --git a/spring-boot-test/src/main/resources/META-INF/spring.factories b/spring-boot-test/src/main/resources/META-INF/spring.factories index b1608c6be2..10c125a43e 100644 --- a/spring-boot-test/src/main/resources/META-INF/spring.factories +++ b/spring-boot-test/src/main/resources/META-INF/spring.factories @@ -1,7 +1,7 @@ # Spring Test ContextCustomizerFactories org.springframework.test.context.ContextCustomizerFactory=\ org.springframework.boot.test.context.ImportsContextCustomizerFactory,\ -org.springframework.boot.test.context.SpringApplicationTestContextCustomizerFactory,\ +org.springframework.boot.test.context.SpringBootTestContextCustomizerFactory,\ org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory,\ org.springframework.boot.test.mock.mockito.MockitoContextCustomizerFactory diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringApplicationTestWebEnvironmentEmbeddedTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestEmbeddedWebEnvironmentTests.java similarity index 95% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringApplicationTestWebEnvironmentEmbeddedTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestEmbeddedWebEnvironmentTests.java index 433add6d3d..75bd664722 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringApplicationTestWebEnvironmentEmbeddedTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestEmbeddedWebEnvironmentTests.java @@ -37,13 +37,13 @@ import org.springframework.web.servlet.DispatcherServlet; import static org.assertj.core.api.Assertions.assertThat; /** - * Base class for {@link SpringApplicationTest} tests configured to start an embedded + * Base class for {@link SpringBootTest} tests configured to start an embedded * servlet container * * @author Phillip Webb * @author Andy Wilkinson */ -public abstract class AbstractSpringApplicationTestWebEnvironmentEmbeddedTests { +public abstract class AbstractSpringBootTestEmbeddedWebEnvironmentTests { @LocalServerPort private int port = 0; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationContextLoaderMockMvcTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderMockMvcTests.java similarity index 95% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationContextLoaderMockMvcTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderMockMvcTests.java index 93c49d256f..183653e1f9 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationContextLoaderMockMvcTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderMockMvcTests.java @@ -48,9 +48,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. */ @RunWith(SpringRunner.class) @DirtiesContext -@ContextConfiguration(loader = SpringApplicationContextLoader.class) +@ContextConfiguration(loader = SpringBootContextLoader.class) @WebAppConfiguration -public class SpringApplicationContextLoaderMockMvcTests { +public class SpringBootContextLoaderMockMvcTests { @Autowired private WebApplicationContext context; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationContextLoaderTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationContextLoaderTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index e78b5dd9cd..a07d5405f0 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationContextLoaderTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -32,11 +32,11 @@ import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationContextLoader} + * Tests for {@link SpringBootContextLoader} * * @author Stephane Nicoll */ -public class SpringApplicationContextLoaderTests { +public class SpringBootContextLoaderTests { @Test public void environmentPropertiesSimple() throws Exception { @@ -104,43 +104,43 @@ public class SpringApplicationContextLoaderTests { assertThat(actual.get(key)).isEqualTo(value); } - @SpringApplicationTest({ "key=myValue", "anotherKey:anotherValue" }) + @SpringBootTest({ "key=myValue", "anotherKey:anotherValue" }) @ContextConfiguration(classes = Config.class) static class SimpleConfig { } - @SpringApplicationTest(properties = { "key=myValue", "anotherKey:anotherValue" }) + @SpringBootTest(properties = { "key=myValue", "anotherKey:anotherValue" }) @ContextConfiguration(classes = Config.class) static class SimpleConfigNonAlias { } - @SpringApplicationTest("server.port=2345") + @SpringBootTest("server.port=2345") @ContextConfiguration(classes = Config.class) static class OverrideConfig { } - @SpringApplicationTest({ "key=myValue", "otherKey=otherValue" }) + @SpringBootTest({ "key=myValue", "otherKey=otherValue" }) @ContextConfiguration(classes = Config.class) static class AppendConfig { } - @SpringApplicationTest({ "key=my=Value", "anotherKey:another:Value" }) + @SpringBootTest({ "key=my=Value", "anotherKey:another:Value" }) @ContextConfiguration(classes = Config.class) static class SameSeparatorInValue { } - @SpringApplicationTest({ "key=my:Value", "anotherKey:another=Value" }) + @SpringBootTest({ "key=my:Value", "anotherKey:another=Value" }) @ContextConfiguration(classes = Config.class) static class AnotherSeparatorInValue { } - @SpringApplicationTest({ "key=myValue", "variables=foo=FOO\n bar=BAR" }) + @SpringBootTest({ "key=myValue", "variables=foo=FOO\n bar=BAR" }) @ContextConfiguration(classes = Config.class) static class NewLineInValue { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestActiveProfileTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestActiveProfileTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestActiveProfileTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestActiveProfileTests.java index b4ab3b3471..5020801443 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestActiveProfileTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestActiveProfileTests.java @@ -29,15 +29,15 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} with active profiles. See gh-1469. + * Tests for {@link SpringBootTest} with active profiles. See gh-1469. * * @author Phillip Webb */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest("spring.config.name=enableother") +@SpringBootTest("spring.config.name=enableother") @ActiveProfiles("override") -public class SpringApplicationTestActiveProfileTests { +public class SpringBootTestActiveProfileTests { @Autowired private ApplicationContext context; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestDefaultConfigurationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestDefaultConfigurationTests.java similarity index 90% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestDefaultConfigurationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestDefaultConfigurationTests.java index 784a8b85a1..3020f113ed 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestDefaultConfigurationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestDefaultConfigurationTests.java @@ -27,13 +27,13 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} (detectDefaultConfigurationClasses). + * Tests for {@link SpringBootTest} (detectDefaultConfigurationClasses). * * @author Dave Syer */ @RunWith(SpringRunner.class) @DirtiesContext -public class SpringApplicationTestDefaultConfigurationTests { +public class SpringBootTestDefaultConfigurationTests { @Autowired private Config config; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestGroovyConfigurationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestGroovyConfigurationTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestGroovyConfigurationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestGroovyConfigurationTests.java index c73edd9de2..41e63db01d 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestGroovyConfigurationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestGroovyConfigurationTests.java @@ -27,15 +27,15 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} (detectDefaultConfigurationClasses). + * Tests for {@link SpringBootTest} (detectDefaultConfigurationClasses). * * @author Dave Syer */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest @ContextConfiguration(locations = "classpath:test.groovy") -public class SpringApplicationTestGroovyConfigurationTests { +public class SpringBootTestGroovyConfigurationTests { @Autowired private String foo; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestGroovyConventionConfigurationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestGroovyConventionConfigurationTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestGroovyConventionConfigurationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestGroovyConventionConfigurationTests.java index 13ddc3f6c6..35f2036f22 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestGroovyConventionConfigurationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestGroovyConventionConfigurationTests.java @@ -26,14 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} finding groovy config. + * Tests for {@link SpringBootTest} finding groovy config. * * @author Phillip Webb */ @RunWith(SpringRunner.class) -@SpringApplicationTest +@SpringBootTest @DirtiesContext -public class SpringApplicationTestGroovyConventionConfigurationTests { +public class SpringBootTestGroovyConventionConfigurationTests { @Autowired private String foo; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestJmxTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestJmxTests.java similarity index 95% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestJmxTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestJmxTests.java index 4ec8accf32..ec7e1520de 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestJmxTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestJmxTests.java @@ -35,8 +35,8 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest -public class SpringApplicationTestJmxTests { +@SpringBootTest +public class SpringBootTestJmxTests { @Value("${spring.jmx.enabled}") private boolean jmx; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestMixedConfigurationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestMixedConfigurationTests.java similarity index 86% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestMixedConfigurationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestMixedConfigurationTests.java index 5ca7d3e05a..aada62892b 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestMixedConfigurationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestMixedConfigurationTests.java @@ -20,7 +20,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringApplicationTestMixedConfigurationTests.Config; +import org.springframework.boot.test.context.SpringBootTestMixedConfigurationTests.Config; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; @@ -29,15 +29,15 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest}. + * Tests for {@link SpringBootTest}. * * @author Dave Syer */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest +@SpringBootTest @ContextConfiguration(classes = Config.class, locations = "classpath:test.groovy") -public class SpringApplicationTestMixedConfigurationTests { +public class SpringBootTestMixedConfigurationTests { @Autowired private String foo; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestPropertyLocationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestPropertyLocationTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestPropertyLocationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestPropertyLocationTests.java index 564a7cbc14..c103529128 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestPropertyLocationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestPropertyLocationTests.java @@ -23,7 +23,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @@ -35,15 +35,15 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} with {@link TestPropertySource} locations. + * Tests for {@link SpringBootTest} with {@link TestPropertySource} locations. * * @author Phillip Webb */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(webEnvironment = WebEnvironment.NONE, properties = "value1=123") +@SpringBootTest(webEnvironment = WebEnvironment.NONE, properties = "value1=123") @TestPropertySource(properties = "value2=456", locations = "classpath:/test-property-source-annotation.properties") -public class SpringApplicationTestPropertyLocationTests { +public class SpringBootTestPropertyLocationTests { @Autowired private Environment environment; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentDefinedPortTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentDefinedPortTests.java similarity index 78% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentDefinedPortTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentDefinedPortTests.java index 6102976011..9be26a952b 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentDefinedPortTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentDefinedPortTests.java @@ -18,7 +18,7 @@ package org.springframework.boot.test.context; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.config.annotation.EnableWebMvc; /** - * Tests for {@link SpringApplicationTest} configured with + * Tests for {@link SpringBootTest} configured with * {@link WebEnvironment#DEFINED_PORT}. * * @author Phillip Webb @@ -34,10 +34,10 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(webEnvironment = WebEnvironment.DEFINED_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT, properties = { "server.port=0", "value=123" }) -public class SpringApplicationTestWebEnvironmentDefinedPortTests - extends AbstractSpringApplicationTestWebEnvironmentEmbeddedTests { +public class SpringBootTestWebEnvironmentDefinedPortTests + extends AbstractSpringBootTestEmbeddedWebEnvironmentTests { @Configuration @EnableWebMvc diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentMockTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockTests.java similarity index 90% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentMockTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockTests.java index ba86f09f6d..bfa8df8b70 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentMockTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentMockTests.java @@ -23,7 +23,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @@ -38,15 +38,15 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} configured with {@link WebEnvironment#MOCK}. + * Tests for {@link SpringBootTest} configured with {@link WebEnvironment#MOCK}. * * @author Phillip Webb * @author Andy Wilkinson */ @RunWith(SpringRunner.class) -@SpringApplicationTest("value=123") +@SpringBootTest("value=123") @DirtiesContext -public class SpringApplicationTestWebEnvironmentMockTests { +public class SpringBootTestWebEnvironmentMockTests { @Value("${value}") private int value = 0; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentRandomPortTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentRandomPortTests.java similarity index 78% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentRandomPortTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentRandomPortTests.java index 0ea4eec6d5..638910e5b3 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWebEnvironmentRandomPortTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWebEnvironmentRandomPortTests.java @@ -18,7 +18,7 @@ package org.springframework.boot.test.context; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationTest.WebEnvironment; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.config.annotation.EnableWebMvc; /** - * Tests for {@link SpringApplicationTest} configured with + * Tests for {@link SpringBootTest} configured with * {@link WebEnvironment#DEFINED_PORT}. * * @author Phillip Webb @@ -34,10 +34,10 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "value=123" }) -public class SpringApplicationTestWebEnvironmentRandomPortTests - extends AbstractSpringApplicationTestWebEnvironmentEmbeddedTests { +public class SpringBootTestWebEnvironmentRandomPortTests + extends AbstractSpringBootTestEmbeddedWebEnvironmentTests { @Configuration @EnableWebMvc diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWithClassesIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithClassesIntegrationTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWithClassesIntegrationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithClassesIntegrationTests.java index 4db2e74709..6a98656141 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWithClassesIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithClassesIntegrationTests.java @@ -31,14 +31,14 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} configured with specific classes. + * Tests for {@link SpringBootTest} configured with specific classes. * * @author Phillip Webb */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest(classes = SpringApplicationTestWithClassesIntegrationTests.Config.class) -public class SpringApplicationTestWithClassesIntegrationTests { +@SpringBootTest(classes = SpringBootTestWithClassesIntegrationTests.Config.class) +public class SpringBootTestWithClassesIntegrationTests { @Rule public ExpectedException thrown = ExpectedException.none(); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWithContextConfigurationIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithContextConfigurationIntegrationTests.java similarity index 85% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWithContextConfigurationIntegrationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithContextConfigurationIntegrationTests.java index 0e3e8d3eb0..7c64db1492 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestWithContextConfigurationIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestWithContextConfigurationIntegrationTests.java @@ -32,15 +32,15 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} configured with {@link ContextConfiguration}. + * Tests for {@link SpringBootTest} configured with {@link ContextConfiguration}. * * @author Phillip Webb */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest -@ContextConfiguration(classes = SpringApplicationTestWithContextConfigurationIntegrationTests.Config.class) -public class SpringApplicationTestWithContextConfigurationIntegrationTests { +@SpringBootTest +@ContextConfiguration(classes = SpringBootTestWithContextConfigurationIntegrationTests.Config.class) +public class SpringBootTestWithContextConfigurationIntegrationTests { @Rule public ExpectedException thrown = ExpectedException.none(); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestXmlConventionConfigurationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestXmlConventionConfigurationTests.java similarity index 88% rename from spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestXmlConventionConfigurationTests.java rename to spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestXmlConventionConfigurationTests.java index 29834ed482..2a49421873 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringApplicationTestXmlConventionConfigurationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestXmlConventionConfigurationTests.java @@ -26,14 +26,14 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link SpringApplicationTest} finding XML config. + * Tests for {@link SpringBootTest} finding XML config. * * @author Phillip Webb */ @RunWith(SpringRunner.class) @DirtiesContext -@SpringApplicationTest -public class SpringApplicationTestXmlConventionConfigurationTests { +@SpringBootTest +public class SpringBootTestXmlConventionConfigurationTests { @Autowired private String foo; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/web/SpringBootMockServletContextTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/web/SpringBootMockServletContextTests.java index a360abbed3..dda6492c70 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/web/SpringBootMockServletContextTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/web/SpringBootMockServletContextTests.java @@ -27,7 +27,7 @@ import javax.servlet.ServletContext; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringApplicationContextLoader; +import org.springframework.boot.test.context.SpringBootContextLoader; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; @@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.nullValue; */ @RunWith(SpringRunner.class) @DirtiesContext -@ContextConfiguration(loader = SpringApplicationContextLoader.class) +@ContextConfiguration(loader = SpringBootContextLoader.class) @WebAppConfiguration("src/test/webapp") public class SpringBootMockServletContextTests implements ServletContextAware { diff --git a/spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringApplicationTestGroovyConventionConfigurationTestsContext.groovy b/spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringBootTestGroovyConventionConfigurationTestsContext.groovy similarity index 100% rename from spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringApplicationTestGroovyConventionConfigurationTestsContext.groovy rename to spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringBootTestGroovyConventionConfigurationTestsContext.groovy diff --git a/spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringApplicationTestXmlConventionConfigurationTests-context.xml b/spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringBootTestXmlConventionConfigurationTests-context.xml similarity index 100% rename from spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringApplicationTestXmlConventionConfigurationTests-context.xml rename to spring-boot-test/src/test/resources/org/springframework/boot/test/context/SpringBootTestXmlConventionConfigurationTests-context.xml