Chapter 8. Refactoring with Mockito

In this chapter, we will cover the following recipes:

  • Removing the problems with instance creation
  • Refactoring the classes that do too much
  • Refactoring the classes that use the class casts
  • Refactoring the classes that use static methods
  • Refactoring the tests that use too many mocks

Introduction

Programmers rarely have the opportunity to work with code that they create from scratch. Often, we have to support systems that have been there for several years and were written at the time when programmers were paid for the number of typed lines of code. However, this is not always the case. Nowadays, when there are so many start-up companies emerging, people tend to sacrifice quality for money. It's all about faster delivery ...

Get Mockito Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.