A pattern for using EasyMock…
May 3rd, 2008
Ralf Stuckert wrote a great article on EasyMock titled "Getting started with EasyMock2." He clearly defined a pattern for using this library.
The pattern is
-
Create a mock.
-
Set up your expectations.
-
Set the mock to replay mode.
-
Call your code under test.
-
Verify that your expectations have been met.
Believe me, knowing this pattern will save you a lot of time trying to figure out how to really use EasyMock when writing tests.
Leave a Reply