spring-framework
spring-framework copied to clipboard
Introduce missing tests for Bean Override features
Overview
Over the past few weeks it has become apparent that our test suite does not fully cover all features of the Bean Override support in the TestContext framework.
To remedy that, we should introduce tests to cover corner cases and features that are currently not tested. As a starting point, we can adopt several of the tests for @MockBean and @SpyBean from Spring Boot's test suite.
Features to Test
The following is a list of features we should make sure we test before Spring Framework 6.2 GA.
- [x] Combining
SpringExtensionandMockitoExtensionon the same test class, including support for@Captorcombined with@MockitoSpyBean. - [x] Support for
@MockitoBeanand@MockitoSpyBeanwhen@ContextHierarchyis used. - [x]
@MockitoBeanreplacement of a bean with@Asyncmethods. - [x]
@MockitoBeanreplacement of a scoped proxy. - [x]
@MockitoBeanreplacement of a Spring AOP proxy. - [ ] Spring AOP proxy that wraps a Mockito spy created via
@MockitoSpyBean. - [ ] Mock reset support for beans within the
ApplicationContextconfigured viaMockReset.before()andMockReset.after().
Related Issues
- https://github.com/spring-projects/spring-boot/issues/22281
- https://github.com/spring-projects/spring-framework/issues/33743