java.lang.IllegalStateException: matcher calls were used outside expectations
at org.easymock.internal.RecordState.replay(RecordState.java:86)
at org.easymock.internal.MocksControl.replay(MocksControl.java:169)
This happens because you are having some kind of code like this, where the .andReturn is not returning an object.
expect(mockdao.bark(EasyMock.anyObject(Dog.class))).andReturn(EasyMock.anyObject(Noise.class)));
To fix this, you should use the null return or return an instance of an object, or even a mock object:
expect(mockdao.bark(EasyMock.anyObject(Dog.class))).andReturn(new Noise()));
Thanks...this is exactly what I was doing
ReplyDeleteDo you know any reason for that?
ReplyDeleteThis worked for me too, thanks :)
ReplyDeleteHeyy exactly the problem. tks
ReplyDeleteThnks a lot
ReplyDeleteThanks..
ReplyDeleteThanks too (I've been struggling for 2 days. even StackOverflow did not give me the answer !)
ReplyDeletethanks its worked for me.
ReplyDeletethanks !!
ReplyDelete