See the linked picture.
I had tests that:
- in response to a, C sends ca and cb to mock versions of A and B.
- in response to cb, B sends ba to a mocked version of A and deals with the (faked) results appropriately.
The bug was that C sent cb before it sent ca. However, ca causes a change in A that affects the results given by ba.
There were a couple of things that contributed to the bug:
1. The real name of what I’m here calling “cb” was not very intention-revealing. It didn’t even hint that cb’s purpose was related to the purpose of “ca”, so it didn’t seem like order mattered. I’ve changed the names to make the relationship clearer.
2. It probably doesn’t make sense for B to be coupled to A. (I think the coupling once did make more sense, but changes over time left only one vestige of their original relationship.) I’ve changed the graph so that C explicitly tells B what it needs to know about A.
So, were I a better programmer, the bug wouldn’t have happened. But: if I’d used real A’s and B’s instead of mock ones, I *might* be more likely to have a test of message “a” that noticed the inconsistency between A and B.