I am using EasyMock to create mock classes in test cases.
expect(entity.getType()).andReturn("string");
Type belongs to the String
datatype. In my development environment it is working fine. But If I transfer to my server and take build, it is failing with following error:
java.lang.IllegalStateException: incompatible return value type
I don't know why it is failing in server and getting executed in my development machine.
Development EasyMock version: 2.5.2
I just had the same problem.
I had a partial mock in EasyMock
, but forgot to call addMockedMethod
for the method I wanted to set the expectation for.
The error message was the same as above, I'd say that was somewhat misleading.
In my case the method was final
on which I called expect
on. So EasyMock
was not able to mock the method and thus did not record the method invocation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With