Reputation: 21924
I realize this has been asked before, but the last time was in mid 2008.
If you were starting a new project right now, which one would you use and why? What are their strengths/weaknesses regarding readability, usability, maintainability, and overall robustness?
Upvotes: 7
Views: 2001
Reputation: 2707
To explain our motivation, jMock is an "opinionated" library. It's designed to guide an approach to OO design that focusses on protocols between collaborating objects. If you don't think of your systems in that way, then it's probably not your best option.
Upvotes: 3
Reputation: 16390
My (biased) answer would be JMockit. For a quick comparison with other mocking toolkits, see the comparison matrix.
Test code written with it should be more readable and better structured (there are example tests for side-by-side comparison). The JMockit mocking API usually requires less "uses" than other mocking APIs to write the same test. The greatest advantage, IMO, is that it doesn't force any design compromises on the code to be tested. On the downside, since JMockit relies on more advanced techniques and has more capabilities, it also has a greater potential for users to run into unexpected difficulties.
Upvotes: 0
Reputation: 444
I have used Easymock earlier, but now I'm using Mockito. I found Mockito simpler as compared to Easymock. For the detailed comparison of Easymock and Mockito you can refer here
Upvotes: 7
Reputation: 356
I have been using EasyMock for some time, now. Continues to add new features that allow one to reach more of those hard-to-get-to places.
Mockito will save some lines of code for most common test cases.
Could you elaborate on your mock capability needs/priorities? Fairly broad, as stated.
Upvotes: 1