When is mocking useful?
- TDD - Test Driven Development
- Write application agains API that is not ready yet or not controlled by you.
- Replace a complex object with a simpler one.
- Isolate parts of the system to test them on their own.
- Speed up tests (e.g. eliminate remote calls, eliminate database calls).
- Simulate cases that are hard to replicate. (What if the other system fails?)
- Unit tests.