Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict typing in comparators may produce a ClassCastException #26

Open
celcius112 opened this issue Sep 27, 2022 · 0 comments
Open

Strict typing in comparators may produce a ClassCastException #26

celcius112 opened this issue Sep 27, 2022 · 0 comments

Comments

@celcius112
Copy link
Contributor

celcius112 commented Sep 27, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant