When we first introduced test doubles, we hinted that there are different names for doubles—mocks, spies, and so on. But we glossed over some of the differences. Let’s take a closer look now.
There are a couple of different ways to think about a test double. One is the usage mode of the double—that is, what you’re using it for and what you’re expecting it to do. The other thing to consider is how the double is created. We’ll call this the double’s origin.
Here are the usage modes we’ll be talking about in this chapter:
Returns canned responses, avoiding any meaningful computation or I/O
Expects specific messages; will raise an error if it doesn’t receive them by the end of the example
A benign test ...