Appendix ATest Refactorings
Extract Testable Component
Also known as
Sprout Class [WEwLC]
You want to be able to test the logic easily but the component is too closely tied to its context to allow such testing.
Extract the logic you want to test into a separate component that is designed for testability and is independent of the context in which it is run.
We extract the logic from the untestable component into a component that is testable via synchronous tests, leaving behind all the ties to the context. This usually means that anything required by the testable component logic from the context is retrieved by the untestable component and passed in to the testable component as arguments of the methods under test or constructor ...