Book Image

Mockito Essentials

By : Sujoy Acharya
Book Image

Mockito Essentials

By: Sujoy Acharya

Overview of this book

Table of Contents (14 chapters)

Chapter 5. Unit Testing the Legacy Code with Mockito

"Legacy code. The phrase strikes disgust in the hearts of programmers. It conjures images of slogging through a murky swamp of tangled undergrowth with leaches beneath and stinging flies above. It conjures odors of murk, slime, stagnancy, and offal. Although our first joy of programming may have been intense, the misery of dealing with legacy code is often sufficient to extinguish that flame."

– Michael C. Feathers, Working Effectively with Legacy Code

This chapter explores the following topics:

  • Understanding the legacy code

  • Working with testing impediments

  • Exploring PowerMock

  • Designing for testability with Mockito and PowerMock