There is a problem, I ask for help, I need it.
(+) if this has already been done.
class WireMockStub: ResponseDefinitionTransformerV2 {
override fun getName(): String {
return "WireMockStub"
}
override fun transform(serveEvent: ServeEvent): ResponseDefinition {
return if (serveEvent.request.url == "/api/webhook/test") {
ResponseDefinitionBuilder
.responseDefinition()
.withStatus(200)
.withBody("{\"testField\": true }")
.build()
} else {
ResponseDefinition()
}
}
}
This is Kotlin but I think javiists will understand
The behavior is as follows. if you do this
WIREMOCK_OPTIONS: "-cp my_jarnik.jar:wiremock-webhooks-extension-3.4.0.jar --extensions org.wiremock.webhooks.Webhooks"
where the 2nd jarnik is an extension in the extension package for the mock classes to work, which I downloaded from the documentation site, and my jarnik with the extension is in the same package, then the wiremock does not start with the error mentioned above, but if you do this
WIREMOCK_OPTIONS: "--extensions org.wiremock.webhooks.Webhooks, ru.rubbles.gap.wiremock.webhook.WireMockStub"
The first argument in the dock is needed to enable the wiremock hook so that everything works, and the 2nd is my extension with the path to the class, I found this elsewhere in the documentation, then the wiremock rises but we don’t see the mock.
404 No response could be served as there are no stub mappings in this WireMock instance.
In general, both options do not work differently....
In the end, everything turned out to be simple, I compiled the required jar on JAVA_17, but it was necessary to compile on JAVA_11, if you compile on 17 it gives an error about version mismatch, and the error was not visible since the project was in Kotlin. As soon as I created a separate repository on JAVA_11, everything worked.