Introduction
Mockito, as the name suggests, is all about working with mocks. It is worth mentioning that before you go and start mocking every class that is in your codebase, it's good to really understand the idea behind mocking and when to mock an object.
While performing unit testing, you will want to test your system in isolation. You're doing it because you want to test a part of the system as a unit and control any external interactions. Remember that in new, well-designed code, your system should follow the SOLID principles (for more details, check out Uncle Bob's blog at http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod and read Agile Software Development, Principles, Patterns, and Practices, Robert C. Martin, which is available at http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445). The complete description about what SOLID stands for is given as follows:
(S) Single responsibility principle: A class should have only a single responsibility...