Terminology

Terminology can be a bit confusing, especially since different people use different names for the same thing. To make things even more complicated, mocking frameworks tend not to be consistent when naming their methods.

Before we proceed, let us briefly go through terminology.

Test doubles is a generic name for all of the following types:

  • Dummy object's purpose is to act as a substitute for a real method argument
  • Test stub can be used to replace a real object with a test-specific object that feeds the desired indirect inputs into the system under test
  • Test Spy captures the indirect output calls made to another component by the System Under Test (SUT) for later verification by the test
  • Mock object replaces an object the SUT depends ...

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.