When trying to test Client class, POST call stubbing works correctly, while GET isn't. What I'm doing wrong here / not understanding correctly?
Client code (POST):
HttpResponse httpResponse = new DefaultHttpRequestBuilder(HttpMethod.POST, SERVICE_URL_GET_MAGIC)
.withBody(parseMagic(magicName))
.execute();
With stubbing (POST):
stubFor(post(urlEqualTo("/api/get-magic"))
.withRequestBody(equalToJson(magicNameParsed))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(magicDtoParsed)));
Works correctly (httpResponse will have 200 OK).
When GET use, it won't stub the api call (httpResponse will be 404 Not found).
HttpResponse httpResponse = new DefaultHttpRequestBuilder(HttpMethod.GET, SERVICE_URL_GET_MAGIC)
.withBody(parseMagic(magicName))
.execute();
stubFor(get(urlEqualTo("/api/get-magic"))
.withRequestBody(equalToJson(magicNameParsed))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(magicDtoParsed)));