Album Cover

Faking & Mocking Java

Close Preview
State or interaction: this may be confusing. After all, when we asserted against FakeTransactionLog's little buffers, we asserted on its state.
But how were those buffers filled? Ahhhhhh, yes: they record the history of how DepositAction interacted with FakeTransactionLog.
DepositAction 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.
| Tweet...
Page rating: | Rate this Page