A JsonValueComparator uses the same type for the actual and expected parameters. This may be problematic when the actual type is not the same as the expected type.
Here's an example:
Actual is
{
"date": null
}
Expected is
{
"date": "{#date_time_format:iso_instant#}"
}
A ClassCastException will be thrown because "date" will be "deserialized" as a null JSONObject, and DateTimeFormatComparator expects an actual of type String.
A
JsonValueComparator
uses the same type for theactual
andexpected
parameters. This may be problematic when the actual type is not the same as the expected type.Here's an example:
Actual is
Expected is
A
ClassCastException
will be thrown because"date"
will be "deserialized" as a nullJSONObject
, andDateTimeFormatComparator
expects anactual
of typeString
.