What version of OpenRewrite are you using?
I guess that RELEASE version right now are
org.openrewrite:rewrite-bom 8.53.0
org.openrewrite:rewrite-maven-plugin 6.9.0
org.openrewrite.recipe:rewrite-testing-frameworks 3.8.0
How are you running OpenRewrite?
I am using this maven cli
MAVEN_OPTS="-Xmx16g -XX:-MaxFDLimit" mvn --debug -Denforcer.skip org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.easymock.EasyMockToMockito -Drewrite.exportDatatables=true
What is the smallest, simplest way to reproduce the problem?
class ATest {
@InjectMocks
private EmdService emdService = new EmdServiceImpl();
}
Where EmdService is an interface
What did you expect to see?
That the code was not changed
What did you see instead?
Instance creation was removed
class ATest {
@InjectMocks
private EmdService emdService;
}
What is the full stack trace of any errors you encountered?
This change make the test cases fail
org.mockito.exceptions.base.MockitoException:
Cannot instantiate @InjectMocks field named 'emdService'! Cause: the type 'EmdService' is an interface.
You haven't provided the instance at field declaration so I tried to construct the instance.
Examples of correct usage of @InjectMocks:
@InjectMocks Service service = new Service();
@InjectMocks Service service;
//and... don't forget about some @Mocks for injection :)
What version of OpenRewrite are you using?
I guess that RELEASE version right now are
org.openrewrite:rewrite-bom 8.53.0
org.openrewrite:rewrite-maven-plugin 6.9.0
org.openrewrite.recipe:rewrite-testing-frameworks 3.8.0
How are you running OpenRewrite?
I am using this maven cli
What is the smallest, simplest way to reproduce the problem?
Where EmdService is an interface
What did you expect to see?
That the code was not changed
What did you see instead?
Instance creation was removed
What is the full stack trace of any errors you encountered?
This change make the test cases fail