Open Manfred73 opened 1 year ago
I haven't checked this in a while to be honest
Cloned your project to give it a try there (updating quarkus version to 2.15.3.Final, java version to 17, disabling preview and added version for assertj).
Added
WireMock.verify(getRequestedFor(urlEqualTo("/v2/name/GR")));
to RegularCountriesServiceTest
and the test passes.
The difference between this test is and my test is that yours uses @QuarkusTest
and in my test I use @QuarkusIntegrationTest
together with RestAssured, because I want my integration tests to run against the native image.
I've been following this example to test my resource, which in turn calls an external resource. I used WireMock to mock the external resource call as described in this demo: https://github.com/geoand/quarkus-test-demo/blob/main/src/test/java/org/acme/getting/started/country/WiremockCountries.java
The stubbing part works fine and I can test the result with RestAssured. But verficiation of the right URL being used at the end of the test fails with a connection refused on localhost:8080.
My
application-test.yaml
:My WireMock proxy class:
The
FilesITProfile
to make sure integration test uses theapplication-test.yaml
:The IntegrationTest:
So everything works fine up till the stubbing and assertions of the result. But the WireMock.verify fails with an exception Connection refused on localhost:8080. I'm not sure where the localhost:8080 is coming from (looks like some default) since I'm using port 8079 as WIREMOCK_PORT and also in my
application-test.yaml
the port is 8088 and not 8080.I've been trying out some things suggested here, but none of them seem to help: https://github.com/wiremock/wiremock/issues/607
Verification works fine with a spring application, but that's configured differently using spring annotations:
Am I missing some configuration or is this a bug?