Add @MockitoSettings(strictness = Strictness.LENIENT) for @MockitoBean tests
ProprietaryWhen migrating from @MockBean to @MockitoBean, the implicit LENIENT Mockito strictness from Spring Boot's MockitoPostProcessor is lost. If @ExtendWith(MockitoExtension.class) is present, Mockito enforces STRICT_STUBS by default, causing UnnecessaryStubbingException for tests with unused stubs. This recipe adds @MockitoSettings(strictness = Strictness.LENIENT) to preserve the original behavior.
io. moderne. java. spring. boot4. AddLenientMockitoSettingsmod run . --recipe= io. moderne. java. spring. boot4. AddLenientMockitoSettingsInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.