| Author |
Easy Mock Test Case
|
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
Got folowing EasyMock exception.
[testng] java.lang.IllegalStateException: matcher calls were used outside expectations
[testng] at org.easymock.internal.RecordState.replay(RecordState.java:84)
[testng] at org.easymock.internal.MocksControl.replay(MocksControl.java:97)
[testng] at org.easymock.EasyMock.replay(EasyMock.java:1540)
|
 |
Junilu Lacar
Bartender
Joined: Feb 26, 2001
Posts: 4118
|
|
|
Did you have a specific question about this? IllegalStateException usually means you need to ensure certain pre-conditions exist before calling a method on an object. Go to the JavaDocs for the class/method that's throwing the exception to see what those pre-conditions are.
|
Junilu - [How to Ask Questions] [How to Answer Questions] [MiH]
|
 |
tom kalafut
Greenhorn
Joined: Dec 03, 2012
Posts: 1
|
|
The exception is reported on the call to replay(), but it's caused by a matcher outside of an expectation. How can I determine where the problem is?
I re-read my code several times to make sure that every void return method called on a mock object with matchers is followed by an expectLastCall(). Example:
payment.setAuthKey(eq(42));
expectLastCall();
|
 |
 |
|
|
subject: Easy Mock Test Case
|
|
|