Introduction: Test Doubles—Stubs and Mocks
Get an introduction to what you’ll learn in this chapter.
We'll cover the following
In this chapter, we’re going to solve a common testing challenge.
How can we test an object that depends on another object? What do we do if that collaborator is difficult to set up with test data?
Several techniques are available to help us with this and they build on the SOLID principles we learned previously. We can use the idea of dependency injection to enable us to replace collaborating objects with ones specially written to help us write our test.
Get hands-on with 1400+ tech skills courses.