Dependency Doubles

Terminology

The component that acts as the external dependency is often called a double of that dependency.

The name comes from the fact that the dependency double looks exactly like the dependency to the callers of the dependency. The implementations of dependency doubles can vary in complexity:

  • A dependency double looks exactly like the external dependency but doesn’t do anything.
  • The dependency double can be used to gain insight into how the dependency is called and possibly test the interaction.

Let’s dive into how we can use dependency doubles in our Soggy Waffle application.

Get hands-on with 1200+ tech skills courses.