I need to return custom exception while mocking a url like
whenever I will hit /test/user/get/ I need to return UserNotFoundException.
I m trying to do like this. Can somebody help me how to return exception in wiremock
public void setupWiresMockStubs(String body, int status) {
wireMockServer.stubFor(post(urlEqualTo(
"/test/user/get"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(body)
.withStatus(status)));
}