cxxr / better-java

Resources for writing modern Java
Other
5.79k stars 729 forks source link

Replacing the jMock example with EasyMock #49

Closed erosb closed 8 years ago

erosb commented 9 years ago

I think EasyMock is a much more widespread mocking library than jMock, so I rewrote the mocking example. Alternatives with links added.

smoyer64 commented 9 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"!

erosb commented 9 years ago

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.

cxxr commented 9 years ago

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.

vincecima commented 9 years ago

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/

cxxr commented 9 years ago

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?

ramonchiara commented 9 years ago

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.

vincecima commented 9 years ago

Having personally used Mockito (but not the others), I think treating it as the prevailing but not only tool is appropriate.

erosb commented 8 years ago

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

cxxr commented 8 years ago

I opened an issue to capture that we want to change the jMock example to Mockito.