Samstag, 10. Dezember 2011

Mockito the Java Standard Mocking Framework?

I used a long time JMock and I really love it, I also used a lot EasyMock because of the answer and capture feature. About a year ago I found the mocking framework mockito. After that I was able to inspire a few work colleagues to use mockito in their projets. I play around with it again and my conclusion is: Mockito is at the moment the best mocking framework for Java and I'm not alone.

"We decided during the main conference that we should use JUnit 4 and Mockito because we think they are the future of TDD and mocking in Java" - Dan North, the originator of BDD

Mockito has a clean syntax and the patterns and ideas behind mockito make tests more maintainable. Mockito has the power of EasyMock but a smarter syntax. Today I build for my self a simple JUnit test as mockito cheat sheet. So you convince yourself with Mockito and the smart API see the demo test bellow.


Links
  • Mockito Project Site
    http://code.google.com/p/mockito/
  • Documentation Mockito
    http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html
  • GitHub Project with the Cheat Sheet Test
    https://github.com/tux2323/mockito-cheat-sheet

Keine Kommentare:

Kommentar veröffentlichen