I was recently researching various mock frameworks for Java. We settled on mockito. I will post more on mockito at another time.

As I was reading about JMock and EasyMock, I had a sense of deja vu. I came across the following report my team developed over 3 years ago. It appears that the report still appears correct:

Feature JMock EasyMock
Special Test Case Class MockObjectTestCase Not Required
Documentation Decent Very good
Test Method Identification String Actual Method
Arguments matcher – i.e. the way we specify how arguments passed should be matched Hard to use but extremely flexible. Easy to use. Less flexible. But it is possible to create our own argument matchers if the need arises. Since in most cases, we don’t need to use complicated argument matchers this should not be a limitation.
Code completions, Refactorings etc Hard since the actual interface is not used in specifying the mock criteria Works well with most IDEs since the actual interface is used
Ease of use and understanding The expectation setting phase in JMock resembles a specification very closely. But it is cumbersome to have to remember so many method calls and write this explicitly. EasyMock is very easy to use since the actual method is called with the correct parameters during the expectation setting phase of preparing the mock. Since 2.2, EasyMock has become much more literate also with effective use of generics and static imports.