Reputation: 3239
In my current setup, if one of my services is down and a request is made to that service, I send a certain HTTP code in the response.
Now to test this I'm using Wiremock to mock my service. Is there a way to mock that the service is unavailable and return a specific response as a result?
I've tried looking through the Wiremock code but there are barely any comments for the methods. I've also tried looking through the docs and I couldn't find anything about bringing down the service.
Upvotes: 1
Views: 1236
Reputation: 8695
you could try ResponseDefinitionBuilder.aResponse().withFault(Fault.CONNECTION_RESET_BY_PEER)
, ResponseDefinitionBuilder.serviceUnavailable()
or simply point your client to a port that is guaranteed to have no listeners, depending on what exactly would you like to test with
service is unavailable and return a specific response as a result
Upvotes: 2