You don’t hate mocks; you hate side-effects.1 When a mock annoys you, it realizes its purpose, showing you where a side-effect is getting in your way. If you refactor away from the side-effect, then you eliminate the mock. The mock is a consequence of your pain, not the cause of it. Please don’t blame the poor mock for doing its job. Clarifying Terms Here, when I say mock I specifically mean an expectation, often implemented by library functions with names like verify(), expect().toHaveBe...