Find Mockito @InjectMocks fields
Proprietary@InjectMocks asks Mockito to wire @Mock-annotated fields into the target's constructor / setters / fields by reflection. In Kotlin code with constructor injection, the cleaner equivalent is to declare the target inside @BeforeEach: val target = Service(mockA, mockB). mockk has no analogous annotation — the explicit constructor call is the convention.
org. openrewrite. kotlin. testing. FindMockitoInjectMocks$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. testing. FindMockitoInjectMocks$KtRecipe'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.