Reputation: 21
I am new to EasyMock in unitTest.
I have a case like this:
EasyMock.expect(serviceUnderTest.functionABC(param)).andReturn("123");
EasyMock.replay(contantsUnderTest);
This only works for the specific param; how can I implement it so that no matter what param is input, if the functionABC in serviceUnderTest is called, it will return 123?
Thank you very much.
Upvotes: 0
Views: 30
Reputation: 24520
You have to use one of EasyMock's matchers.
EasyMock
.expect(
serviceUnderTest.functionABC(EasyMock.anyObject(TypeOfParameter.class)))
.andReturn("123");
For more details have a look at EasyMock's Javadoc.
Upvotes: 1