I'm trying to use testcontainers to create a MockServer docker instance, but when I use mockserver-junit-jupiter module at version 5.10.0 I realize that this version is outdated (v5.4.0) and the with a simple test:
@Test
fun mockContainer() {
MockServerClient(mockServer.containerIpAddress, mockServer.serverPort)
.`when`(HttpRequest.request()
.withPath("/person")
.withQueryStringParameter("name", "peter"))
.respond(HttpResponse.response()
.withBody("Peter the person!"))
}
I received the error:
java.lang.IllegalArgumentException: 1 error:
- object instance has properties which are not allowed by the schema: ["id","priority"]
at org.mockserver.client.MockServerClient.sendRequest(MockServerClient.java:192)
at org.mockserver.client.MockServerClient.upsert(MockServerClient.java:844)
at org.mockserver.client.ForwardChainExpectation.respond(ForwardChainExpectation.java:49)
at ...
I created this issue on MockServer but I realize that the problem on testcontainers.
I created this PR to solve this issue
You can pass in the required version when creating the mockserver container ie
new MockServerContainer("5.10.0");
@JakobFels, unfortunately, I can't. the current docker hub repository is no longer maintained and the most recent version is 5.7.2 (17 Nov 2019). https://hub.docker.com/r/jamesdbloom/mockserver/
That's not very true:
https://hub.docker.com/r/jamesdbloom/mockserver/tags
I'm sorry, I checked again and realize that the @JakobFels tip worked. Just the docker hub documentation is outdated. Thanks, everyone.
Most helpful comment
You can pass in the required version when creating the mockserver container ie