Closed erosb closed 8 years ago
From what I've seen, Mockito is the up-and-coming mocking library. It's not clear to me that any of these three systems is likely to become dominant - would it make sense to have parallel examples? "Sensible mocking" should certainly be promoted as part of "Better Java"!
EasyMock and Mockito both seems to be mainstream for me. jMock on the other hand is something I've never heard before. I sent this PR with an EasyMock example because that is my personal preference, but Mockito is fine too.
Interestingly enough I polled a few Java devs I know and Mockito and jMock were the dominant examples and only one had heard of EasyMock. Maybe there's a poll of Java devs asking which libraries they use? Maybe one is clearly better than the others? I don't know, as I've only used Mockito and jMock.
Here is a survey done by JRebel from last year that touches on mocking tools:
http://zeroturnaround.com/rebellabs/java-tools-and-technologies-landscape-for-2014/16/
From that it seems like Mockito is the clear winner by popularity. jMock and EasyMock aren't mentioned. Is there a way that EasyMock is better than Mockito in some way?
Using Google Trends, I can see that Mockito has been the trend (vastly).
https://www.google.com.br/trends/explore#q=jmock%2C%20easymock%2C%20mockito
2015-12-02 13:30 GMT-02:00 Sean Cassidy notifications@github.com:
Interestingly enough I polled a few Java devs I know and Mockito and jMock were the dominant examples and only one had heard of EasyMock. Maybe there's a poll of Java devs asking which libraries they use? Maybe one is clearly better than the others? I don't know, as I've only used Mockito and jMock.
— Reply to this email directly or view it on GitHub https://github.com/cxxr/better-java/pull/49#issuecomment-161333070.
Having personally used Mockito (but not the others), I think treating it as the prevailing but not only tool is appropriate.
Thank you all for the comments, rewriting the example to easymock clearly does not make sense. Thanks for pointing that out, I'm closing this PR
I opened an issue to capture that we want to change the jMock example to Mockito.
I think EasyMock is a much more widespread mocking library than jMock, so I rewrote the mocking example. Alternatives with links added.