our tests set up an object, exercise it, then check the resulting state of the object or its collaborators
our tests set up an object, exercise it,
and check that it interacted with the mock(s)
the way we expected.
State or interaction: this may be confusing. After all, when we asserted against
's little buffers, we asserted on its state.
But how were those buffers filled? Ahhhhhh, yes: they record the history of how
may have some state, but in this case we care about (and assert on) its interactions.
A mock is the ideal tool when we care about an object's interactions
: which methods were called, what parameters were passed,
and so on.
Mock objects check the interaction between collaborating objects.
||use this markup:
(Supported languages: java, cpp, csharp, c, python.)
|a method or class name