[ACCEPTED]-java.lang.IllegalStateException: incompatible return value type-easymock
I just had the same problem.
I had a partial 4 mock in EasyMock
, but forgot to call addMockedMethod
for the method 3 I wanted to set the expectation for.
The 2 error message was the same as above, I'd 1 say that was somewhat misleading.
In my case the method was final
on which I called 2 expect
on. So EasyMock
was not able to mock the method 1 and thus did not record the method invocation.
Make sure that your entity
object is not a simple 2 POJO (eg. new Entity()
), and it was created with the 1 createMock()
methods of EasyMock.
For me, I had to remember to call reset(...) on 3 it after having used it once, or I (bizarrely) got 2 this error message calling expect on it 1 a second time.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.