Dependency injection supplies a component’s dependencies from outside rather than having it construct them internally. It supports testability by allowing troublesome dependencies to be replaced with test doubles. section 5.4.3
Replacing heavyweight services with simulated dependencies can make tests simpler and faster: tests can run as in-memory unit tests instead of relying on integration-test infrastructure. section 5.4.4
Substitute a test double
If a component depends on an external service, inject a test double that simulates it. For database access, inject a mock DAO to avoid the database in a unit test. section 5.4.3 section 5.4.4



























