Package org.mockserver.imports
Class MountebankImporter
java.lang.Object
org.mockserver.imports.MountebankImporter
Imports MockServer expectations from Mountebank imposter
JSON.
Accepts a single imposter object, a { "imposters": [ ... ] } wrapper (the mb config
file / GET /imposters?replayable=true format), or a bare JSON array of imposters. Only
http/https imposters are mapped — tcp/smtp imposters are skipped
with a per-imposter ImportWarning.
Mapping
- Predicates (
equals/deepEquals/contains/matches/exists/startsWith/endsWith) over themethod,path,query,headersandbodyrequest fields become MockServer matchers; all predicates in a stub are AND-combined into one request matcher. isresponses becomeHttpResponses (statusCode/headers/body).proxyresponses becomeHttpForwards (to host/port/scheme).- A response
faultbecomes anHttpError. _behaviors.waitbecomes a response delay;_behaviors.repeatis reported as anImportWarningand otherwise dropped — a Mountebank single response wraps and is served indefinitely, so aTimes.exactly(N)constraint would wrongly make the stub 404 after N matching requests.- A stub with multiple
isresponses becomes one sequential/cycling multi-response expectation; mixed or non-ismulti-response stubs fall back to the first response with a warning.
Compound predicates (and/or/not), JavaScript inject responses,
and post-processing behaviours (decorate/copy/lookup/shellTransform)
have no MockServer equivalent and are reported as ImportWarnings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionimportExpectations(String imposterJson) importExpectations(String imposterJson, ImportRedaction.Options redactionOptions)
-
Constructor Details
-
MountebankImporter
public MountebankImporter()
-
-
Method Details
-
importExpectations
-
importExpectations
public ImportResult importExpectations(String imposterJson, ImportRedaction.Options redactionOptions)
-