This message was deleted.
# help
s
This message was deleted.
m
I then tried with
@RegisterExtension
but it appears the WM server isn’t started yet when my
@BeforeEach
is invoked.
Copy code
@QuarkusTest
internal class FooTest {
    @RegisterExtension
    val wireMockExtension = WireMockExtension.newInstance()
        .options(wireMockConfig().dynamicPort().dynamicHttpsPort())
        .build()!!

    @BeforeEach
    fun `set-up mocks`() {
        // fails with NPE because server isn't started yet
        wireMockExtension.baseUrl()
    }
}
The only way to make this work AFAICS is to use the plain Java setup and do everything manually.
Copy code
@QuarkusTest
internal class FooTest {

    companion object {
        private val wireMockServer = WireMockServer(options().dynamicPort())

        @JvmStatic
        @BeforeAll
        fun startWireMockServer() {
            wireMockServer.start()
        }

        @JvmStatic
        @AfterAll
        fun stopWireMockServer() {
            wireMockServer.stop()
        }
    }
}
The downside is that I need to prefix all WM method calls like
stubFor
or
verify
with
wireMockServer.
for them to go to the one WM instance created manually.
o
@Marcel definitely it shouldn't be like that. Due to the reasons unknown why more context gets serialized, and it's not designed for that
It is not a stack trace and particularly missing from the Jenkins times :) I can take a look later, but maybe the temperature solution would be using the wiremock developer service https://docs.quarkiverse.io/quarkus-wiremock/dev/index.html