spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Introduce missing tests for Bean Override features

Open sbrannen opened this issue 1 year ago • 0 comments

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 SpringExtension and MockitoExtension on the same test class, including support for @Captor combined with @MockitoSpyBean.
  • [x] Support for @MockitoBean and @MockitoSpyBean when @ContextHierarchy is used.
  • [x] @MockitoBean replacement of a bean with @Async methods.
  • [x] @MockitoBean replacement of a scoped proxy.
  • [x] @MockitoBean replacement of a Spring AOP proxy.
  • [ ] Spring AOP proxy that wraps a Mockito spy created via @MockitoSpyBean.
  • [ ] Mock reset support for beans within the ApplicationContext configured via MockReset.before() and MockReset.after().

Related Issues

  • https://github.com/spring-projects/spring-boot/issues/22281
  • https://github.com/spring-projects/spring-framework/issues/33743

sbrannen avatar Oct 18 '24 14:10 sbrannen