I have recently read “Instant Mockito” by Marcin Grzejszczak. Good reading.
I use Mockito every day but, nevertheless, the book could give me hints and ideas on how to improve Mockito usage in my projects. For example, I discovered the @InjectMocks annotation and several special arguments matchers I did not know before.
I suggest the book to all experienced programmers.
The book is not a Mockito primer nor it is a tutorial on unit testing techniques. The author assumes you know already how (and why) to do unit testing. Beginners should better start with more introductive books.
Mockito methods are not documented in detail; you should refer to official Mockito documentation for a complete reference (all relevant links can be found at the end of the book).
The first part of the book explains what is Mockito, how to install it in projects based on Maven and other dependency managers and a shows quick start example. Short but the essential is in.
The second part is the most interesting (at least for me) with the section named “Top 8 features you need to know about” which is basically a Mockito showcase: the author describes, by examples, several use cases using almost all Mockito features.
Among them: void methods stubbing, method calls counting, exceptions handling, method arguments capture, legacy code spying and annotations usage.
The book ends with references to Mockito resources available on the Net: web sites, Twitter accounts, blogs, communities.
(Available from Packt Publishing)