JMock is a library that supports test-driven development of Java code with mock objects.Mock objects help you design and test the interactions between the objects in your programs.
The jMock library:
- makes it quick and easy to define mock objects, so you don't break the rhythm of programming.
- lets you precisely specify the interactions between your objects, reducing the brittleness of your tests.
- works well with the autocompletion and refactoring features of your IDE
- plugs into your favourite test framework
- is easy to extend.
Comments
I was skeptical, but not for long
I was introduce to mocking with a few different tools. My initial reaction was "what's the point." Sure, you can avoid having to implement methods in an interface as the interface changes, but that's not really a big deal.
Not long after using JMock 2.0 to try to explicitly state expectations, something clicked in my brain. Now I really appreciate using a mock library.
JMock 2.0 comes with an excellent catalog. I've also got a few examples you can check out: http://schuchert.wikispaces.com/TDD+Example+Catalog.
http://schuchert.wikispaces.com