What problem are you trying to solve?
I am trying to migrate from JMock to Mockito. Multiple of my projects use a combination of JMock and Mockito for unit testing. I am trying to consolidate the tests to just use Mockito.
What precondition(s) should be checked before applying this recipe?
Mockito v5.x should be preferable.
Describe the situation before applying the recipe
@Test
public void sampleTest() {
...
mockery.checking(new Expectations() {
{
allowing(objectOne).getPropertyOne();
will(returnValue(propertyOneValue));
allowing(objectTwo).getPropertyTwo();
will(returnValue(propertyTwoValue));
}
});
...
}
Describe the situation after applying the recipe
@Test
public void sampleTest() {
when(objectOne.getPropertyOne()).thenReturn(propertyOneValue);
when(objectTwo.getPropertyTwo()).thenReturn(propertyTwoValue);
}
Have you considered any alternatives or workarounds?
Apart from doing a manual migration, no.
Yes. I am interested :D
What problem are you trying to solve?
I am trying to migrate from JMock to Mockito. Multiple of my projects use a combination of JMock and Mockito for unit testing. I am trying to consolidate the tests to just use Mockito.
What precondition(s) should be checked before applying this recipe?
Mockito v5.x should be preferable.
Describe the situation before applying the recipe
Describe the situation after applying the recipe
Have you considered any alternatives or workarounds?
Apart from doing a manual migration, no.
Are you interested in contributing this recipe to OpenRewrite?
Yes. I am interested :D