I have an integration test that ends up making two API calls to the same service. One is a GET call, and the other is a PUT. When it calls the GET, it works just fine, but when it calls the PUT, it doesn't find a matching request and throws an exception.
The userService in the below example is a WireMock Server
Here is my stubbing
private void stub() {
userService.stubFor(
get(urlPathEqualTo("/api/v1/users/" + userId))
.willReturn(
aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withHeader(HttpHeaders.CONNECTION, "close")
.withBody(
"{"
+ "\"id\": \""
+ userId
+ "\","
+ "\"name\": \""
+ userName
+ "\""
+ "}")));
userService.stubFor(
put(urlPathEqualTo("/api/v1/users"))
.willReturn(
aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withHeader(HttpHeaders.CONNECTION, "close")));
}
The exception that ends up being thrown from the PUT call is
Caused by: org.springframework.retry.RetryException: Could not recover; nested exception is java.lang.AbstractMethodError: Receiver class org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient does not define or inherit an implementation of the resolved method 'abstract org.springframework.cloud.client.ServiceInstance choose(java.lang.String, org.springframework.cloud.client.loadbalancer.Request)' of interface org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser.