Rust usually gives you a pleasant experience: if it compiles — it works. But strong type checking doesn’t eliminate necessity of testing. Especially if your code deals with some external dependencies:
- Have your checked the behaviour of your code on all error paths? May there be typo, incorrect condition, that passes type checks but contradicts with your intentions?
- What if dependency returns success on the first call, but error for the second?
- What if there’s sudden network issue?
To cover such cases there is a common approach — substitute, or “mock”, your dependencies by special, configurable test objects with same interface. And here our story begins.