October 2009
Intermediate to advanced
384 pages
8h 54m
English
We use jMock2 as our mock object framework throughout this book. This chapter summarizes its features and shows some examples of how to use them. We’re using JUnit 4.6 (we assume you’re familiar with it); jMock also supports JUnit3. Full documentation is available at www.jmock.org.
We’ll show the structure of a jMock unit test and describe what its features do. Here’s a whole example:

First, we set up the test fixture class by creating its Mockery.

For the object under test, a