Package org.mockserver.mock.pact
Class PactExporter
java.lang.Object
org.mockserver.mock.pact.PactExporter
Exports MockServer response expectations as a
Pact v3 consumer contract (JSON), so traffic mocked or
recorded in MockServer can be published to a Pact Broker / PactFlow and used for
consumer-driven contract testing.
Only expectations with an HttpResponse action and a concrete HttpRequest
matcher are exported — forward, callback, and template actions have no Pact equivalent and are
skipped. Matcher values are emitted as concrete example values (Pact's default exact matching);
MockServer matching rules (regex, JSON-schema, XPath, …) are not yet translated into Pact
matchingRules and a body that is not a literal value is exported as its string form.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PactExporter
public PactExporter()
-
-
Method Details
-
export
- Parameters:
expectations- the expectations to export (typically the active expectations)consumer- the consumer name (defaults to "consumer" when blank)provider- the provider name (defaults to "provider" when blank)- Returns:
- the Pact contract as pretty-printed JSON
-