O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Encapsulation and Override Variations

Chapter 6 introduced a technique to encapsulate functionality in such a way that we could override it for better control while testing. This chapter elaborates on that approach with several variations. We use encapsulation to create seams in our code that can then be exploited for verification. We also look at the use of test doubles (see the sidebar “Test Doubles and Interface-Based Design”) to help us.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required