Hello Team :bow: First of all, thank you for creat...
# help
s
Hello Team 🙇 First of all, thank you for creating a great project. I have one question about verifying request. I want to make test fail when json request body’s number scale(precision) is different. example pseudocode is like below.
Copy code
// expectedRequestBody : {"number": 1.00}
// actualRequestBody : {"number": 1}
verify(postRequestedFor(urlEqualTo("/verify/this"))
        .withRequestBody(equalToJson(expectedReqestBody)));
For now, above test result is success. I checked wiremock’s code and I found that number comparator used by
EqualToJsonPattern
is
NormalisedNumberComparator
which is remove trailing zeros before compare. Is there any way to compare number without trailing zeros or using custom number comparator? Thank you for your answer in advance.
l
Hi, at the moment we don't have a way to customise the
NumberComparator
. You could use the
find(…)
method instead to retrieve the events, then perform your own assertion(s) on these events.
🙌 1
🙏 1