← Graph

Fake Object

concept 4 connections

A test double implemented as a full class (not just a stub on a method) that mimics the interface of a production collaborator but whose behavior can be controlled from tests. In Rodzik's talk, `FakeDice` accepts a list of roll results and is injected in place of the real `Dice`, letting tests deterministically exercise tie/win/lose branches. Tradeoffs: adds code to the test suite, must be kept in sync with the real implementation, and risks locking in a poor abstraction. Discussed alternatives include `instance_double` (guards method names but not return-value shapes) and running the same behavior suite against both the fake and the real implementation.

category
pattern
about
Fake Object concept
FakeDice is introduced as a full class substituted for the real Dice.
about
Fake Object concept
The injected collaborator is a fake implementation.
Asks about the scope where fakes are sufficient.
about
Fake Object concept
Asks where fake implementations should physically reside.

Provenance

Read by
4 extractions