Computer Science I / Modular Decomposition and Reuse
Practice question · Multiple choice

Two modules each work perfectly and fail when combined. What kind of defect does that suggest, and why do unit tests miss it?

Hints
  1. Unit tests replace the other module with a mock. Ask what the mock is built from.
  2. One returns null for 'not found'; the other expects an empty list. Who is wrong?
Show the answer

B. An interface mismatch, which only an integrated test reveals

Why

Unit tests check each module against your belief about the other, encoded in a mock, so a mistaken belief is baked into both sides and neither test fails. It is precisely what integration testing exists for, and why contract or consumer-driven tests are used to pin the boundary down explicitly.

Read the lesson: Modular Decomposition and Reuse →

Practise Modular Decomposition and Reuse

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Modular Decomposition and Reuse