Remove MockitoAnnotations.initMocks(this) and openMocks(this) if JUnit runners specified

MSAL

Remove MockitoAnnotations.initMocks(this) and MockitoAnnotations.openMocks(this) if class-level JUnit runners @RunWith(MockitoJUnitRunner.class) or @ExtendWith(MockitoExtension.class) are specified. These manual initialization calls are redundant when using Mockito's JUnit integration. Note that the @Mock fields will then be initialized by the strict mocking session of the extension or runner; tests that relied on the lenient mocks created by an explicit openMocks(this) call inside @BeforeEach may surface UnnecessaryStubbingException. Add @MockitoSettings(strictness = Strictness.LENIENT) to opt out.

org.openrewrite.java.testing.mockito.RemoveInitMocksIfRunnersSpecified
mod run . --recipe=org.openrewrite.java.testing.mockito.RemoveInitMocksIfRunnersSpecified

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.