Test-Driven Development with Mockito
By Sujoy Acharya
Publisher: Packt Publishing
Final Release Date: November 2013
Pages: 172

In Detail

The usual life cycle of code involves adding code, breaking an existing functionality, fixing that and breaking a new area! This fragility can be fixed using automated tests and Test Driven Development.

TDD’s test first approach expedites the development process and unit tests act as safety nets for code refactoring and help in maintaining and extending the code. This makes TDD highly beneficial for new projects.

This practical, hands-on guide provides you with a number of clear, step-by-step exercises that will help you to take advantage of the real power that is behind Test Driven Development and the Mockito framework. By using this book, you will gain the knowledge that you need to use the Mockito framework in your project.

This book explains the concept of Test Driven Development (TDD), including mocking and refactoring, as well as breaking down the mystery and confusion that surrounds the test first approach of TDD. It will take you through a number of clear, practical examples that will help you to take advantage of TDD with the Mockito framework, quickly and painlessly.

You will learn how to write unit tests, refactor code and remove code smells. We will also take a look at mock objects and learn to use Mockito framework to stub, mock, verify and spy objects for testability. You will also learn to write clean, maintainable, and extensible code using design principles and patterns.

If you want to take advantage of using Test Driven Development and learn about mocking frameworks, then this is the book for you. You will learn everything you need to know to apply Test Driven Development in a real life project, as well as how to refactor legacy code and write quality code using design patterns.


This book is a hands-on guide, full of practical examples to illustrate the concepts of Test Driven Development.

Who this book is for

If you are a developer who wants to develop software following Test Driven Development using Mockito and leveraging various Mockito features, this book is ideal for you. You don’t need prior knowledge of TDD, Mockito, or JUnit.

It is ideal for developers, who have some experience in Java application development as well as a basic knowledge of unit testing, but it covers the basic fundamentals of TDD and JUnit testing to get you acquainted with these concepts before delving into them.

Product Details
Recommended for You
Customer Reviews


by PowerReviews
oreillyTest-Driven Development with Mockito

(based on 1 review)

Ratings Distribution

  • 5 Stars



  • 4 Stars



  • 3 Stars



  • 2 Stars



  • 1 Stars



Reviewed by 1 customer

Displaying review 1

Back to top


Little of Value

By Dave

from St. Louis, MO

About Me Developer

Verified Reviewer



    • Difficult to understand
    • Not comprehensive enough
    • Too basic
    • Too many errors

    Best Uses

    • Novice

    Comments about oreilly Test-Driven Development with Mockito:

    If the reader is persistent enough to struggle through a difficult to read book that relies heavily on poorly constructed examples, s/he will be able to learn the basics of Test-Driven Development and Mockito. Concepts are not covered in enough depth to benefit an expert, and are not explained well enough for a beginner.

    The Biggest Issues:

    Poor Readability: copious typos and misuse of English make the non-code sections difficult to understand. Section/subsection headings are all formatted in the same style, obscuring section/subsection layout; headerless subsection transitions are poorly cued and often confusing.

    Limited Content: most material in the book is only covered at a cursory level. Several chapters contain so little information that they could be omitted without affecting the reader's learning experience. TDD and Mockito techniques and principles are covered adequately at an introductory level for the determined reader. The reader will have to find alternate sources if s/he desires to understand how Mockito calls are structured or how to use Mockito features other than by adapting from examples.

    Badly Constructed Examples: example code is poorly formatted, using arbitrary boldface and indentation. Mockito configuration isn't mentioned until after the first chapter that uses Mockito. Many example projects require the reader to implement portions of the code, but the author is unclear about which portions need to be implemented and what they will do, and which portions will be covered within the current subsection. Author doesn't always specify whether tests will pass after revision, and inconsistent about following the standard red->green->refactor cycle.

    Displaying review 1

    Back to top

    Buy 2 Get 1 Free Free Shipping Guarantee
    Buying Options
    Immediate Access - Go Digital what's this?
    Ebook:  $23.99
    Formats:  ePub, Mobi, PDF