Class BaselineDiffer

java.lang.Object
org.mockserver.mock.diff.BaselineDiffer

public class BaselineDiffer extends Object
Compares a CURRENT set of recorded interactions against a previously-saved BASELINE and produces a structured BaselineDiffReport so CI can detect when the shape of recorded traffic changed.

Interactions are matched across the two sets by a stable request key of METHOD path (method upper-cased, path normalized by stripping a trailing slash). For each matched pair:

  • request fields are diffed with TrafficDiffEngine (method, path, body, headers, query, cookies)
  • response structure is diffed — status code, headers, and JSON body shape

Structural (value-insensitive) response body diffing: JSON bodies are compared by shape, not by value. A different value at the same field with the same JSON type is NOT drift; a new field, a removed field, or a field whose JSON type changed (e.g. string → number, object → array) IS drift. Non-JSON bodies fall back to an exact-string comparison.