Hello guys. In PactDslJsonBody we need to validate...
# pactflow
i
Hello guys. In PactDslJsonBody we need to validate the Boolean Value that is returned. For that purpose, we're supposed to use booleanValue. However, the validation is not performed. Provider test passes now matter if we send false or true. The workaround is to use booleanType and then in the contract to update the matcher from
Copy code
"matchers": [
  {
    "match": "type"
  }
]
to
Copy code
"matchers": [
  {
    "match": "value"
  }
]
and then it works. Are you aware of it? Should bug be opened? New to the community 🙂 Thank you!
b
Hi @Izanna Kutepov, I think this question is a better fit for the language specific channel, I think you’re looking for #C9UN99H24. It does sound like a bug. What version of the Pact consumer library are you using? I’m curious to see if I can reproduce it.
i
Thank you! Should i repost this question there? This is what we use, looks like the recent one:
Copy code
implementation 'au.com.dius.pact.provider:junit5spring:4.6.8'
b
Yes please! And yes, that’s a very recent version indeed
i
Thank you so much! I posted there as well
👍 1
m
Boolean value is a matcher that matches a...Boolean value. Both true and false are booleans so the test passes. If it were a string or a number it would fail. If you want to match exact value either 1. Don't specify a matcher 2. Use the equality matcher (if in the context of a broader cascading matcher e.g. each like)