Overview
A fake is a more complex test double than a mock or a stub. It actually contains logic, but it is simplified for testing purposes.
Example
An in-memory database (like H2 or an array) is a common 'fake' for a real database like PostgreSQL. It allows you to run tests that involve data persistence without the overhead of a real database server.
Benefits
- Allows for more realistic testing than simple stubs.
- Faster than using real production-grade dependencies.