Skip to content

MockServer Expectation Initializers #7753

Closed Answered by eddumelendez
PePirex asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, according to MockServer docs you can use the env vars

MOCKSERVER_WATCH_INITIALIZATION_JSON=true
MOCKSERVER_INITIALIZATION_JSON_PATH=mockserverInitialization.json

So, you can do something like

var mockServer = new MockServerContainer("image")
    .withEnv("MOCKSERVER_WATCH_INITIALIZATION_JSON", "true")
    .withEnv("MOCKSERVER_INITIALIZATION_JSON_PATH", "mockserverInitialization.json")
    .withCopyFileToContainer(Mountable.fromClasspath("file-in-src-test-resources.json", "mockserverInitialization.json"));

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PePirex
Comment options

Answer selected by PePirex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants