Mocks & Stubs

A mock verifies behavior and interaction.

  • Was it called?
  • With what arguments?

A stub provides canned answers and controlled data in place of a real component or dependency.

  • Fixed return values
  • Predictable inputs for your test