Testcontainers-java: Outdated MockServer version

Created on 6 Apr 2020  路  5Comments  路  Source: testcontainers/testcontainers-java

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.

Most helpful comment

You can pass in the required version when creating the mockserver container ie

new MockServerContainer("5.10.0");

All 5 comments

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/

I'm sorry, I checked again and realize that the @JakobFels tip worked. Just the docker hub documentation is outdated. Thanks, everyone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aruizca picture aruizca  路  4Comments

aniketbhatnagar picture aniketbhatnagar  路  3Comments

richard77 picture richard77  路  3Comments

dabraham02124 picture dabraham02124  路  3Comments

itudoben picture itudoben  路  3Comments