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

Synchronize through Injection

Synchronizing through a common lock works well as long as the common lock exists and is accessible. But what do you do when the lock is not available, or the locks that are available are in the wrong places? You create your own!

Chapter 12 looked at the various ways you can use injection points as seams. Whether through dependency injection frameworks, callbacks, registries, or logging and monitoring frameworks, the ability to inject a test double allows you to also inject synchronization.

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