I changed the return value of a method in my code from void to and Object.
Then two junit test failed stating that an expect(...).andReturn(...) was missing. After adding those one test is fixed and the other still throws an exception which seems a bit weird:
java.lang.IllegalStateException: matcher calls were used outside expectations
The code which works for one but not the other is:
expect(myMock.foo(1l,FooEnum.A)).andReturn(EasyMock.anyObject(String.class));
Any ideas?
I changed to code to
and now it works. It's still strange why I get this error since I definitely return a
new Object(and notnullor anything)