Open GoogleCodeExporter opened 8 years ago
One more thing. The testcase does not always fail on that same line. A
different test just failed setting up a Mockito.when on the
'reserveWorkCapacity' method with the same error I showed above:
Mockito.when(mockMediator.reserveWorkCapacity(mockCommandUtilization)).thenRetur
n(true);
Original comment by jw.ma...@gmail.com
on 12 Sep 2013 at 1:17
it might also be important to know that the class being mocked extends straight
from Object and does not implement any interfaces.
I've been using Mockito for MANY years. I've never seen this. When it does
fail, it is during a "mvn clean package", and the test in question is run by
the failsafe plugin during the verify phase as it is an "*IT".
Original comment by jw.ma...@gmail.com
on 12 Sep 2013 at 1:20
In an effort to stabilize this test I extracted an interface from the class
being mocked. It still fails, with a little lower frequency.
Original comment by jw.ma...@gmail.com
on 18 Oct 2013 at 12:51
Hi I think you may encounter an issue in your code base, where the mock is
redefined after being used. This may happen when the mock is used/reused in an
asynchronous environment. I've seen such cases when used in TestNG on on some
occasion when run in JUnit code used as integration tests.
This is probably not an issue with mockito, but rather a misuse of the mock.
You should follow the usage of your mocks. Mocks behavior can only be stubbed
correctly and safely if done synchronously and usually before the test begins.
I don't have access to your code, so for now that's all I can say.
Cheers,
Brice
Original comment by brice.du...@gmail.com
on 4 Dec 2013 at 2:26
Thanks for the feedback. I actually no longer have access to the codebase where
the situation was occurring. Recreating would be difficult. I'll ping the guys
currently working on that project to see if it's still a problem, if they want
to pursue this further.
Original comment by jw.ma...@gmail.com
on 4 Dec 2013 at 2:49
OK, thanks
Original comment by brice.du...@gmail.com
on 4 Dec 2013 at 2:56
Original issue reported on code.google.com by
jw.ma...@gmail.com
on 12 Sep 2013 at 12:56