Backend & systems·Testing and test doubles
you assert that the email service was called exactly once with this address, and the test fails if it was not.
Mock
A double with pre-programmed expectations about how it will be called, which fails the test when they are not met. It verifies interactions rather than results, which is right when the observable effect is the call itself — an email sent, a message published. Overusing mocks welds the test to the implementation, so refactoring breaks tests without breaking behaviour.