Test Doubles --> Mocks (mock, spy) & Stub (stub, dummy, fake)
- Waits to be called by the class under Test.
- Mock object are used for behaviour verification.
- Mock can fail the test.
- It can provide data and logic needed by the class.
- Gives out data that goes under class/object under test.
- Stub object are used for state verification.
- Stub cannot fail the test, it returns stub value.
- Data is directly injected into the class.
Satender Kumar Mall