Rework the new testing support so that @SpringApplicationTest can be
used for standard integration tests, web integration tests with a
mock Servlet environment and web integration tests with an embedded
servlet container. This means that it a replacement for 1.3's
@IntegrationTest and @WebIntegrationTest and allows all
SpringApplication testing to be configured using a common annotation.
The old @IntegrationTest and @WebIntegrationTest along with their
supporting classes have been reinstated to their previous form (while
remaining deprecated). This should ensure that they continue to work
in 1.4 exactly as they did in 1.3 giving users a smooth path to
@SpringApplicationTest.
See gh-5477
Remove the need for a nested @Configuration class when writing a test
that need to @Import configuration.
Primarily added to allow @ImportAutoConfiguration to be used directly
on test classes.
Fixes gh-5473
Add a ContextCustomizerFactory to provide TestRestTemplate as a bean for
tests annotated with WebIntegrationTests. Additionally provide support
for automatically expanding URLs of the form `/example` to
`http://localhost:${local.server.port}/example`.
Fixes gh-5227
Provide variants of `WebClient` and `WebConnectionHtmlUnitDriver` that
automatically resolve relative URLs to "localhost:${local.server.port}".
Fixes gh-5472
Add a `@MockBean` annotation which can be used to setup and inject mocks
into an application context. The annotation can be used on test classes,
test fields, configuration classes or configuration fields. When used on
a field the annotation also acts as an injection point.
Fixes gh-5042
Update @IntegrationTest to use @BootstrapWith rather than an explicitly
defined set of test execution listeners.
Also introduce a new @SpringApplicationTest annotation that is similar
to @SpringApplicationConfiguration but a bootstrapper.
Fixes gh-5230
Allow detection of `@SpringBootConfiguration` classes for both standard
spring tests and bootstrap (@IntegrationTest @WebIntegrationTest) based
tests.
Closes gh-5295
Add TestTypeExcludeFilter which will automatically attempt to exclude
test only configurations. All `@Configuration` annotated inner-classes
of tests are automatically excluded. The `@TestConfiguration` annotation
can be used to explicitly if a configuration needs explicit exclusion.
See gh-5295
See gh-4901