I am doing a functional testing of a service A. The function is triggered by an api call 1 from service B and then at last respond (send another api call 2) to the service B. Therefore, the plan is to wiremock the service B and make a call 1 and then verify that it get a api call 2 request back.
We use wiremock in the docker compose file to simulate the service B as below:
service-b:
image: ***/wiremock-service-b
ports:
- "8081:8081"
volumes:
- ./wiremock/service-b/mappings/:/home/wiremock/mappings/
Is there any way I can get THIS service B wiremock instance (deployed in docker) using java code and triggered a call 1 and then verify a call 2 request coming back? Please help. Thanks.
If the docker compose is running, you can configure the default static WireMock client to use it as so:
as you are port forwarding to
8081
.See WireMock > Java configuration for further details.
You can then verify that service B was called as usual:
See Wiremock > Verifying for further details.