Easymock - 2 minute tutorial

How to define mock behaviour for hardcoded arguments

After creating mock objects, you need to define behaviour of mock objects. This is done by using methods expect(...) and andReturn(...) of class org.easymock.EasyMock. After defining these methods, the replay(...) method must be called on the mocked object before calling the stubbed methods.

The example defines the behaviour of mock object when the method get(0) is called on it.