Thursday, March 14, 2013

java.lang.IllegalStateException: 0 matchers expected, 2 recorded.

There could be whatever java.lang.IllegalStateException: m matchers expected, n recorded.
If you are programmer like monkey with keyboard (like me currently, sadly) and you are getting this, there are few things you can check first:
1) it could be that this exception does not come from the place it says it comes, that is, real failing part was previous test and this happens in next test where it first saw call to expect(..) method;
2) in some cases expect(..)/ verify() does  not like to work with (MyObject) EasyMock.anyObject() - make sure you don't use EasyMock.anyObject() if you are getting this exception.

No comments:

Post a Comment