Write a review to share your experiences with open source!
On DevRates we focus on reviews by developers using libraries on their daily work.
Interested in the latest trends and top-rated open source projects for all layers of your application?
DevRates contains projects reviews of most popular tagged categories and programming languages.
Follow projects and don't miss any news from blogs and twitter on your wall.
Your company is looking for talented developers? Register on DevRates and show your technology stack on your company profile.
Java mocking is dominated by expect-run-verify libraries like EasyMock or jMock. Mockito offers simpler and more intuitive approach: you ask questions about interactions after execution. Using mockito, you can verify what you want. Using expect-run-verify libraries you are often forced to look after irrelevant interactions.
No expect-run-verify also means that Mockito mocks are often ready without expensive setup upfront. They aim to be transparent and let the developer to focus on testing selected behavior rather than absorb attention.
Mockito has very slim API, almost no time is needed to start mocking. There is only one kind of mock, there is only one way of creating mocks. Just remember that stubbing goes before execution, verifications of interactions go afterwards. You'll soon notice how natural is that kind of mocking when TDD-ing java code.
Mockito has similar syntax to EasyMock, therefore you can refactor safely. Mockito doesn't understand the notion of 'expectation'. There is only stubbing and verifications.
Mockito implements what Gerard Meszaros calls a Test Spy.
full review »Easier than Easy Mock
Appears to be less complete than Powermock...
full review »Easy, simple and intuitive. Especially take a look at @InjectMocks and @Mock if You're Spring user.
full review »Easy to use mock framework with a well designed API.
full review »Very easy, intuitive and feature-full. I use it along with Powermock (when needed) and Fest assert and it gives me a complete unit testing workshop.