Menu

#4 Mock assertion counting does not seem to be thread safe

EasyMock_2.4
closed
EasyMock (40)
5
2012-10-05
2008-04-28
Andrea Aime
No

Hi,
I had a test in which a single mock object was called back by various different threads concurrently and it randomly failed to count the calls to each method, leading to unexpected test failures.

I then modified the test so that each thread had its own mock object to hit and I got back repeatable successes.
The drawback is, my test got quite a bit more complex.

Would it be possible to make mock objects thread safe, or to have the ability to create a synchronized wrapper for them, something like EasyMock.synchronizedMock(mock), mimicking what Collections.synchronizedXXX(collection) methods do?

Discussion


Log in to post a comment.

MongoDB Logo MongoDB