Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of LastCall.IgnoreArguments in EasyMock

I have used Rhino.Mocks extensively currently writing some tests in Java using EasyMocks. However I was unable to pull out a LastCall.IgnoreArguments() Rhino.Mocks equivalent in EasyMocks.

How do I use Easy Mocks to return a value irrespective of the arguments in the method.

For example:

public interface ISoothSayer {

   String SaySomethingSweet(String sweetMsg);
}

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

like image 461
abhilash Avatar asked Apr 01 '09 17:04

abhilash


1 Answers

You can use isA, like below (mock is a ISoothSayer mock):

expect(mock.SaySomethingSweet(isA(String.class))).andReturn("Hell Oh World");
like image 190
Rafael Mueller Avatar answered Sep 22 '22 21:09

Rafael Mueller