If a method of a class which will be mocked by EasyMock did return some value, you should specify the return value explicitly before you use the mock object in your unit test case. Or else EasyMock will complain:
java.lang.IllegalStateException: missing behavior definition for the preceeding method call xxx
An example:
Say we have a interface named Subject which has a member method as follows:
Then we should use EasyMock to mock this interface in following way:
Note the line contains andReturn. If you missed the call to andReturn, EasyMock will throw out the above IllegalStateException.