Book Image

Test-Driven Java Development

Book Image

Test-Driven Java Development

Overview of this book

Table of Contents (17 chapters)
Test-Driven Java Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
8
Refactoring Legacy Code – Making it Young Again
Index

Chapter 8. Refactoring Legacy Code – Making it Young Again

 

"Fear is the path to the dark side. Fear leads to anger. Anger leads to hate. Hate leads to suffering."

 
 --Yoda

TDD might not adjust straightaway to legacy code. You may have to fiddle a bit with the steps to make it work. Understand that your TDD might change in this case. That, somehow, you are no longer performing the TDD you were used. This chapter will introduce you to the world of legacy code, taking as much as we can from TDD.

We'll start a fresh, with a legacy application that is currently in production. We'll alter it in small ways without introducing defects or regressions and we'll even have time to have an early lunch!

The following topics are covered in this chapter:

  • Legacy code

  • Dealing with legacy code

  • REST communication

  • Dependency injection

  • Tests at different levels: end to end, integration, and unit