-
Andy Wilkinson authored
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
bf9d23e5
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
java/org/springframework/boot/test | ||
kotlin/org/springframework/boot/test/web/client | ||
resources | ||
webapp |