Comparing Call-Order and Observable-Outcome Checks

Comparing Call-Order and Observable-Outcome Checks

Try Press Step to reveal the baseline and compare the order of the helper calls with the returned warning before the refactor.

Predict the results of a strict internal call-order check and an observable-outcome check after a harmless refactor and after a behavior regression.

Unit testing
Expected call order
Prepare diagnostic context
Prepare warning label
Temperature stub

Returns one step above the limit.

Expected call order

Prepare diagnostic context → Prepare warning label. Independent internal preparations with no externally visible effects.

Expected verdict

Warning raised.

Pin the expectations

Set up separate checks for internal call order and the returned verdict.

Observe In frame 4, Warning label moves ahead of Context, and Call order shows FAIL while Verdict shows PASS. By frame 6, Context is first again, Call order shows PASS, and Verdict shows FAIL.
Explain In frame 4, the order check fails because the independent helpers swap places, while the returned warning still matches. In frame 6, the original order matches again, but the verdict check catches the missing warning.

Technical boundaries. The replay uses a temperature stub fixed one step above the limit and assumes the two helper calls have no externally visible effects. It compares the baseline with a helper swap and a wrong verdict for that same input.

Back to the chapter