spring-boot/spring-boot-project/spring-boot-test
Andy Wilkinson bf9d23e55a Consider SpringBootTest's web environment in context cache key
Previously, the web environment configured on `@SpringBootTest` was not
part of the context cache key. As a result, two test classes that has
identical configuration other than one using a MOCK web environment and
the other using a DEFINED_PORT web environment would share a context
when they should not do so. Classes that use MOCK and RANDOM_PORT were
not affected as the use of RANDOM_PORT results in a property for the
port being added to the environment.

This commit adds a new ContextCustomizer, SpringBootTestWebEnvironment,
that is used to capture the `webEnvironment` from `@SpringBootTest`
and use it in its hashCode and equals implementations. This fixes the
problem as all context customizers are evaluated when determing the
equality of two context cache keys.

Fixes gh-23085
2020-09-24 14:43:51 +01:00
..
src Consider SpringBootTest's web environment in context cache key 2020-09-24 14:43:51 +01:00
pom.xml Merge branch '2.1.x' 2019-10-02 10:48:57 +01:00