One of the primary principles of unit testing is to test a small piece of functionality in isolation. In order to achieve this, mock objects are often necessary. Historically using mocks could be quite painful. After using several mock frameworks, my favorite by far is Mockito.
In this tutorial we will walk through examples of the most common features of Mockito. My sample project can be downloaded here.
Interfaces and Implementation
Some mocking frameworks only supported mocking interfaces. As a result our projects became bloated with useless interfaces that were only used for testing. Mockito creates mock objects with interfaces or classes.