EasyMock - do you have to reset() mocks after test?
easymock, java, mocking, unit-testing
Solution
It seems you don't need to manually reset the mocks.
In my case the mocked class was stored in a static variable, once this was corrected the tests started running OK.
It would be nice if EasyMock reported the place where violated expectation was recorded - that would have made it much easier to find the source of the problem.
Problem
I think the answer is yes, but I was unable to find anything definite in the easymock documentation. I'm getting an error when first test is mocking a class, and then another test is using this class in a regular way. The class turns out to be mocked in the second test and fails with unexpected invocation. Is there a way to automate the cleanup, besides using the `EasyMockSupport` and calling `resetAll()` in `@After` method (preferably something that doesn't have to be repeated in each class)?