Mark Abdel Malak
08/21/2024, 5:03 PMmockGreetingService.stubFor(
method("greeting")
.withRequestMessage(equalToJson("{ \"name\": \"${json-unit.any-string}\" }"))
.willReturn(
jsonTemplate(
"{ \"greeting\": \"Hello {{jsonPath request.body '$.name'}}\" }")));
How can templated responses be performed with java objects. The example in the docs only states
mockGreetingService.stubFor(
method("greeting")
.withRequestMessage(equalToMessage(HelloRequest.newBuilder().setName("Tom")))
.willReturn(message(HelloResponse.newBuilder().setGreeting("OK"))));
which doesn't let you
1. use any string to match the name - as per example one
2. access request.body
in any way
Is there a way to do this or is it a gap?Tom
08/21/2024, 5:34 PMMark Abdel Malak
08/23/2024, 8:37 AM