Archive

Posts Tagged ‘mock objects’

Reset those mock objects

November 21st, 2007

Lately I’ve been rolling mock objects into my unit tests. I selected EasyMock since it came up first in the Google search. Everything was going well until I wanted to test return values with the expectLastCall(…) method. If you’re not familiar:

It seems to follow the (disjointed) EasyMock documentation, but fails with “Unexpected method call find(1)”. Since I’m creating my mock objects at the start of every test method, I needed to call reset(…) on my mock objects. Using TestNG, this is straightforward:

nick Entry , ,