mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-21 13:31:46 +00:00
Prior to this commit, SpringAopBypassingVerificationStartedListener provided partial support for transparent verification for Mockito spies created via @MockitoSpyBean when the spy is wrapped in a Spring AOP proxy. However, attempting to actually verify invocations for a spy resulted in an exception from Mockito since MockUtil.isMock() returned false in such scenarios. This commit addresses that by introducing a SpringMockResolver that resolves mocks by walking the Spring AOP proxy chain until the target or a non-static proxy is found. SpringMockResolver is automatically registered whenever the spring-test JAR is on the classpath, allowing Mockito to transparently resolve mocks wrapped in Spring AOP proxies. Closes gh-33774