Reputation: 61
It's easy enough in EasyMock to do:
EasyMock.expect(service.methodCall());
but I noticed that this does not test the order in which I execute the calls, which in a case that I am trying to test is very important. Is there anyway to do this with EasyMock?
Upvotes: 6
Views: 5033
Reputation: 8190
If you need to test the order across different mocked objects, you can use EasyMock.createStrictControl()
to create the mocks, run replay()
& verify()
.
This site has some handy sample code: http://www.michaelminella.com/testing/mock-controls-with-easymock.html (archive.org mirror)
Upvotes: 2
Reputation: 2301
You can use the EasyMock.createStrictMock()
for creating a mock thats capable of checking the order of method calls.
http://easymock.org/EasyMock3_0_Documentation.html
(search for "Checking Method Call Order Between Mocks" in the above link for examples).
Upvotes: 7