Test Double: Dummy (Meszaros)

Details

Core Concepts:

Purpose

An object passed to fill a required parameter but never actually used in the test. The simplest form of test double.

Behavior

Has no behavior. Calls to a Dummy should not occur — if they do, something is wrong with the test setup.

Typical use

Satisfying constructor or method signatures where the parameter is irrelevant to the test scenario.

Key Proponent

Gerard Meszaros ("xUnit Test Patterns", 2007)

When to Use:

  • Tell an LLM: "Create a Dummy test double for this parameter — it should never be called"

  • When a method requires parameters that are irrelevant to the behavior being tested

  • Filling dependency injection containers with unused dependencies