Package org.mockserver.mock.diff
Class BaselineDiffer
java.lang.Object
org.mockserver.mock.diff.BaselineDiffer
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOne recorded interaction (request + response). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiff(List<BaselineDiffer.Interaction> baseline, List<BaselineDiffer.Interaction> current) Compare two sets of recorded interactions.diffExpectations(List<Expectation> baseline, List<Expectation> current) Compare two sets of expectations.static StringrequestKey(HttpRequest request) Stable cross-set matching key:METHOD normalized-path.
-
Constructor Details
-
BaselineDiffer
public BaselineDiffer()
-
-
Method Details
-
diffExpectations
Compare two sets of expectations. Only expectations with a concreteHttpRequestand anHttpResponseaction participate in the diff. -
diff
public BaselineDiffReport diff(List<BaselineDiffer.Interaction> baseline, List<BaselineDiffer.Interaction> current) Compare two sets of recorded interactions. -
requestKey
Stable cross-set matching key:METHOD normalized-path. Method is upper-cased; the path has a single trailing slash stripped (but"/"is preserved).
-