Migrate EasyMock code to Mockito
MSALChange EasyMock types, mock creation, expectations and argument matchers to their Mockito equivalents, and remove replay and verify calls.
org. openrewrite. java. testing. easymock. EasyMockCodeToMockitomod run . --recipe= org. openrewrite. java. testing. easymock. EasyMockCodeToMockitoInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Replace EasyMock
verifycalls with Mockitoverifycalls - Remove method invocations
org.easymock.IExpectationSetters times(..) - Remove method invocations
org.easymock.IExpectationSetters once() - Remove method invocations
org.easymock.IExpectationSetters atLeastOnce() - Remove method invocations
org.easymock.IExpectationSetters anyTimes() - Remove method invocations
org.easymock.IMocksControl replay(..) - Remove method invocations
org.easymock.EasyMock replay(..) - Remove method invocations
org.easymock.IMocksControl verify(..) - Remove method invocations
org.easymock.IMocksControl verifyRecording(..) - Remove method invocations
org.easymock.IMocksControl verifyUnexpectedCalls(..) - Remove method invocations
org.easymock.EasyMockSupport replayAll() - Remove method invocations
org.easymock.EasyMockSupport verifyAll() - Change method name
org.easymock.IExpectationSetters andReturn(..)tothenReturn - Change method name
org.easymock.IExpectationSetters andThrow(java.lang.Throwable)tothenThrow - Change method name
org.easymock.IExpectationSetters andAnswer(..)tothenAnswer - Change method name
org.easymock.IExpectationSetters andStubReturn(..)tothenReturn - Change method name
org.easymock.IExpectationSetters andStubThrow(java.lang.Throwable)tothenThrow - Change method name
org.easymock.IExpectationSetters andStubAnswer(..)tothenAnswer - Change method target to static
- Change method target to static
- Change type
IArgumentMatchertoArgumentMatcher - Change method name
org.easymock.EasyMock anyObject(..)toany - Change method name
org.easymock.EasyMock capture(..)toargThat - Change method name
org.easymock.EasyMock reportMatcher(..)toargThat - Change method name
org.easymock.EasyMock expect(..)towhen - Change method name
org.easymock.EasyMock createNiceMock(..)tomock - Change method name
org.easymock.EasyMock createStrictMock(..)tomock - Change method name
org.easymock.EasyMock createMock(..)tomock - Change method name
org.easymock.EasyMock niceMock(..)tomock - Change method name
org.easymock.EasyMock strictMock(..)tomock - Reorder method arguments
- Change method target to static
- Change method target to static
- Change method target to static
- Change method target to static
- Change method target to static
- Change method target to static
- Change method target to static
- Remove
extends EasyMockSupportfrom test classes - Change type
EasyMocktoMockito - Change type
EasyMockRunnertoMockitoJUnitRunner - Change type
org.easymock.Mocktoorg.mockito.Mock - Change type
TestSubjecttoInjectMocks