You can use an implementation IAnswer and write code to do it. In the code, there's a static method on EasyMock you can call to retrieve arguments. There should be some examples scattered in the unit tests (e.g. there may be a mock scope container and such).

Jim

On Sep 8, 2006, at 12:27 PM, Raymond Feng wrote:

A question about EasyMock:

For the following interface:

public interface Dummy {
   void setName(String name);
   String getName();
}

How do I mock the behavior of Dummy so that the getName() always return the latest argument passed from setName()? I don't want to hard-code it in andReturn().

Thanks,
Raymond

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to