PacktLib: Test-Driven Development with Mockito

Test-Driven Development with Mockito

Credits

About the Author

About the Reviewer

www.PacktPub.com

Preface

Getting Familiar with TDD

Definition of test

The big picture

Refactoring

Summary

Refactoring – Roll the Dice

Refactoring

Summary

Applying TDD

Understanding different test types

Understanding TDD – a real-life example

Summary

Understanding the Difference between Inside-out and Outside-in

Understanding outside-in

Understanding inside-out

Summary

Test Doubles

Categories of test doubles

Summary

Mockito Magic

An overview of Mockito

Qualities of unit testing

Drinking Mockito

Verifying redundant invocation

The argument matcher

Throwing exceptions

Consecutive calls

Stubbing with callbacks – using the Answer class

Spying objects

Using doReturn()

Working with Void methods

Argument capture

Summary

Leveraging the Mockito Framework in TDD

Applying Mockito

Summary

World of Patterns

Characteristics of a bad design

Design principles

Design patterns

Summary

TDD, Legacy Code, and Mockito

What is legacy code?

Problems with legacy code

Diving into the legacy puzzle

Refactoring legacy code

The role of Mockito

Summary

TDD Tools and Frameworks

TDD Tools and Frameworks

TDD Tools and Frameworks

TDD Tools and Frameworks

TDD Tools and Frameworks

TDD Tools and Frameworks

Agile Practices

Agile Practices

Agile Practices

Agile Practices

Agile Practices

Index