Skip to content
Advertisement

Tag: wiremock

Integration tests with WireMock failing because no ALPN Processors are found

I’m writing some integration tests for a Spring Boot application written in Kotlin. To stub some HTTP requests, I’m using WireMock via spring-cloud-contract-wiremock as dependency. Some anonymized sample code from an integration test: While running these tests on my local machine, everything is working fine. On the CI/CD environment it’s failing though with the following error: I did some searching

Wiremock stubbing error: “Unrecognized field “timestamp” (class com.github.tomakehurst.wiremock.common.Errors), not marked as ignorable”

here I come because I have not found any solution to my problem. I’m actually trying to stub a response with wiremock (that call to the Mocked service is be done via FeignClient). My intention is to get a fake response with the real feign client, not in a test, but in the real application. Therefore, In this case, I’m

How to use WireMock’s response template in JUnit 5 Tests

I’m trying to use the Response Templating feature of WireMock, but it does not seem to work with the sample piece of code provided in the docs. This is a sample piece of code: Expected Output: Tests should pass. (meaning the {{request.url}} should be substituted with /test-url as a result of template rendering). Actual Output: Things I’ve tried: Since these

Is it possible to simulate connection timeout using wiremock tools?

I know that it can simulate SocketTimeoutException by using withFixedDelay, but what about ConnectionTimeoutException? Answer Yes it is possible to do this with WireMock by calling addDelayBeforeProcessingRequests(300) against the Java API or posting the following to http://<host>:<port>/__admin/socket-delay: { “milliseconds”: 300 } (Obviously replacing 300 with however many milliseconds you’d like to delay by)

Advertisement