In this chapter, we have learned how to leverage monkey patching to swap out dependencies in our tests. With monkey patching, we have tested globals, decoupled packages, and removed our dependence on external resources such as databases and the filesystem. We've worked through some practical examples while improving our sample service's code, and we frankly discussed both the advantages and disadvantages of using monkey patching.
In the next chapter, we will look at the second and perhaps the most traditional DI technique, dependency injection with constructor injection. With it, we will improve our service's code even further.