Aleksei Parfentjev
07/29/2025, 7:06 PMwireMock.stubFor(<http://WireMock.post|WireMock.post>("/convert")
.withFormParam("amount", WireMock.equalTo("10.50"))
.willReturn(responseDefinition1));
wireMock.stubFor(<http://WireMock.post|WireMock.post>("/convert")
.withFormParam("amount", WireMock.equalTo("12.50"))
.willReturn(responseDefinition2));
However, the amount can easily be 10.5 or 12.5 due to inconsistent precision, and that doesn't work - 10.50 and 10.5 are different strings. I solved this by extending StringValuePattern and overriding it's matcher which now converts both values to BigDecimal and compares them with compareTo.
My concern is that I perhaps overengineered this and missed a simpler solution. Is there one to compare decimal values in form params?
I only found a similar issue with JSON bodies: https://github.com/wiremock/wiremock/pull/2588Tom
07/30/2025, 4:55 PM^10\.5[0]?$Aleksei Parfentjev
07/30/2025, 5:25 PMTom
07/30/2025, 7:57 PM