liveBook · Manning

Intra-system communication

As explained in Unit Testing Principles, Practices, and Patterns

Communication between classes or components within the same application.

Intra-system communication is communication between classes inside an application. It describes collaborations used to perform an operation, not behavior directly visible to the client. section 5.3

Treat these collaborations as implementation details when designing tests. Testing them directly couples tests to internal structure and makes refactoring fragile; verify the public API and resulting business behavior instead. section 5.3 section 5.5

Distinguish intra-system communication from boundary communication:

  • Intra-system communication occurs between classes within the application and is generally an implementation detail. section 5.3
  • Inter-system communication crosses the application boundary and forms observable behavior when external effects are visible. section 5.3 section 5.5
  • Mock inter-system calls when their externally visible side effects matter; avoid mocks that merely verify internal domain collaborations. section 5.5

A purchase workflow

A controller retrieves a customer and product, invokes the customer's purchase operation, and sends an email receipt after success. Verify the returned success and the receipt sent through the external gateway; do not make the test depend on the customer's internal store interaction.

How Unit Testing Principles, Practices, and Patterns covers it

How deep it goes
Defines the distinction, explains its testing consequences, and contrasts fragile internal mocks with boundary-focused verification.
Examples
Uses customer purchasing, inventory interaction, email gateways, domain classes, and application services as contrasting testing examples.
What it assumes
Assumes familiarity with classes, domain layers, application services, and mocks while defining the communication distinction explicitly.
What you can do after
Diagnose test fragility by separating internal collaborations from externally visible communication and mock only the relevant boundary.
How it connects
Connects intra-system communication to inter-system communication, observable behavior, mocks, test fragility, domain layers, and application services.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.