Mastering Unit Testing Using Mockito and JUnit
A practical and easy-to-follow, yet comprehensive, guide to learning advanced JUnit testing. Each topic is explained and placed in context, and for the more inquisitive, there are more details of the concepts used. This book is for you if you are a developer with some experience in Java application development as well as a basic knowledge of JUnit testing. But for those whose skill set is void of any prior experience with JUnit testing, the book also covers basic fundamentals to get you acquainted with the concepts before putting them into practise.
What people are saying - Write a review
This book has its pros (real life trips and tricks, best practices, describing tools and methods) and cons (not very well organized chapters, too broad range of topics).
Chapters about JUnit and Mockito are very thorough, but I guess miss their audience. They are too fast for a beginner, but too slow for an experienced professional. I guess they can be useful if you treat them as a comprehensive kind of "reference guide". Sometimes I thought that the book relies too heavily on Mockito's argument captors - even though the author mentions that this is not a good practice, as they create fragile test cases.
Chapters on unit testing the web and data tier - even though it is a really nice idea to discuss these topics in a book like this, mixing in Spring is a bit too much.
Chapters 9 and 10 are the best part of the book, where the author offers practical, real life solutions to everyday problems of a maintenance guy (testing spaghetti code - logic and GUI components mixed together, final classes, global, static state). Those things are very well described and exemplified, they can come in real handy for the inexperienced. The book also offers a very good overview on all the different reasons why a piece of code becomes hard to test.