Equivalent to LastCall.IgnoreArguments in EasyMock

I used Rhino.Mocks, currently actively writing some Java tests using EasyMocks. However, I was not able to pull the equivalent of LastCall.IgnoreArguments () Rhino.Mocks into EasyMocks.

How to use Easy Mocks to return a value regardless of method arguments.

For example:

public interface ISoothSayer {

   String SaySomethingSweet(String sweetMsg);
}

how I mock this interface to return "Hell Oh World", regardless of the argument, sweetMsg.

+5
source share
1 answer

You can use isA as shown below (mock is the ISoothSayer layout):

expect(mock.SaySomethingSweet(isA(String.class))).andReturn("Hell Oh World");
+8
source

All Articles