Class WireMockImporter
Accepts three shapes, matching WireMock's own on-disk / API formats:
- a single stub-mapping object (
{ "request": {...}, "response": {...} }); - a
mappingswrapper ({ "mappings": [ {stub}, ... ] }) — theGET /__admin/mappingsexport andmappings/directory format; - a bare JSON array of stub-mappings.
Mapping
| WireMock request | MockServer matcher |
|---|---|
method | method (dropped when ANY) |
urlPath | exact path |
urlPathPattern / urlPattern | regex path |
url | exact path + query parameters |
queryParameters, headers | parameter / header matchers
(equalTo exact, matches regex, contains regex, absent) |
bodyPatterns | body matcher (equalToJson, matchesJsonPath,
contains, matches/equalTo) |
The response maps to an HttpResponse (status/headers/body/base64Body/
jsonBody, fixedDelayMilliseconds → delay); fault maps to an
HttpError; a proxyBaseUrl response maps to an HttpForward. WireMock
scenarios (scenarioName/requiredScenarioState/newScenarioState) map
directly onto MockServer scenarios, and priority maps to MockServer priority 5 - p
(WireMock 1 = highest and an unspecified WireMock priority defaults to 5, so the mapping keeps an
explicit priority sitting relative to MockServer's unspecified default of 0 the same way it sits
relative to WireMock's default of 5).
Constructs with no faithful MockServer equivalent (e.g. matchesXPath,
delayDistribution, response transformers) are reported as ImportWarnings
rather than silently dropped.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionimportExpectations(String wireMockJson) importExpectations(String wireMockJson, ImportRedaction.Options redactionOptions)
-
Constructor Details
-
WireMockImporter
public WireMockImporter()
-
-
Method Details
-
importExpectations
-
importExpectations
public ImportResult importExpectations(String wireMockJson, ImportRedaction.Options redactionOptions)
-