Hello everyone, I'm looking for some clarity on wh...
# pact-jvm
t
Hello everyone, I'm looking for some clarity on what stringType() and numberType() methods are matching on using them to construct a jsonBody. My provider is verifying the pact generated using this method but it's using the example parameter as the literal value to compare against. For example i see error messages like "1.14) body: $payment.paymentAmount Expected null (Null) to be an integer" when providing something like .object("payment").numberType("paymentAmount").closeObject(). Any ideas?
m
Expected null (Null) to be an integer
that means your API is sending
null
for a property you have deemed to be a
string
type. That would be the correct error (it’s not a string).
If you expected it to be
null
, use
nullType
(I’m guessing it or similar exists)
t
ok can i ask, conceptually, if using something like .numberType("paymentAmount",12.92), should my provider be verifying the exact value in the 2nd parameter? even though it's an example?
m
No I think that's a type matcher but would use that example in the contract
t
I'm finding in the provider that that is not currently the case. For example it shows • -"customerFullName": "RAC" • + "customerFullName": "ABCDEF" I created a mockServer and mockService, so that an object with "customerFullName": "ABCDEF" is returned for verification.
m
Mind sharing the generated pact file? (even if redacted to a minimal example that shows the problem)
t
Thanks for the help! here's what i've generated. I also am sharing logs from the provider test
m
This error says that the body itself was
null
, not that property
t
I made some edits, does this mean the consumer isn't populating the map?
actually nevermind i figured it out