JMock is a popular mocking framework for Java. Several versions are available.
The sections below illustrate using various versions of JMock for the mocking parts of Using Testing Frameworks with Groovy.
The Item Storer Example
We are going to consider how you might use JMock as part of testing the Item Storer Example.
Here is how we can test
JavaStorer using version 1.x of JMock using its JUnit 3 integration: