Class WireMockImporter

java.lang.Object
org.mockserver.imports.WireMockImporter

public class WireMockImporter extends Object
Imports MockServer expectations from WireMock stub-mapping JSON.

Accepts three shapes, matching WireMock's own on-disk / API formats:

  • a single stub-mapping object ({ "request": {...}, "response": {...} });
  • a mappings wrapper ({ "mappings": [ {stub}, ... ] }) — the GET /__admin/mappings export and mappings/ directory format;
  • a bare JSON array of stub-mappings.

Mapping

WireMock requestMockServer matcher
methodmethod (dropped when ANY)
urlPathexact path
urlPathPattern / urlPatternregex path
urlexact path + query parameters
queryParameters, headersparameter / header matchers (equalTo exact, matches regex, contains regex, absent)
bodyPatternsbody 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.