I'm migrating a project from Spring Boot 3, to 4.0.0.M3 with an existing test class using @WebMvc which has an Mockito argument captor as:

@Captor
ArgumentCaptor<UUID> uuidArgumentCaptor;

Under Spring Boot 4, the captor is not initialized. Work around is to annotate the test class with @ExtendWith(MockitoExtension.class)

Unexpected behavior, not sure if this is a bug, or intentional change?

Example here

Comment From: wilkinsona

This is to be expected following the removal of the deprecated-since-3.4 MockitoTestExecutionListener. Using MockitoExtension is the right thing to do. We should add something to the migration guide as it's not obvious that this functionality's been removed as the tests themselves don't directly refer to the deprecated and then removed code.

Comment From: springframeworkguru

Thanks for the quick response and explanation @wilkinsona!

Comment From: philwebb

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide/6b6a69ab25b8695e2710b2408b5cee29b77ff234