JsonMatchers don't reliably match type
Closed this issue · 0 comments
poohsen commented
I was surprised to find that this matcher succeeds:
"JsonMatchers" should {
"match type" in {
val json = """{"id":1}"""
json must /("id" -> "1.0")
}
}
IMO only selectors that are numerical types should match, so something like json must /("id" -> 1)
or json must /("id" -> 1.0)
.
Interestingly, the type is taken into account the other way around:
// this fails:
"JsonMatchers" should {
"match type" in {
val json = """{"id":"1"}"""
json must /("id" -> 1)
}
}
Is this a known shortfall of this class?