Posted on May 3, 2008

A pattern for using EasyMock…

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

    1. Create a mock.

    2. Set up your expectations.

    3. Set the mock to replay mode.

    4. Call your code under test.

    5. 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.

Spam Protection by WP-SpamFree