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

Add test case that checks consistency of equalsIgnoreCase() #748

Closed
gsaviane opened this issue Dec 23, 2022 · 3 comments
Closed

Add test case that checks consistency of equalsIgnoreCase() #748

gsaviane opened this issue Dec 23, 2022 · 3 comments

Comments

@gsaviane
Copy link

In some equals() implementation you can find string fields compared ignoring the case. If, for instance, you have such implementation of equals() and hashCode()
![image](https://user-images.githubusercontent.com/12230922/209340938-c04bcbc2-c0b0-4326-91c8-3814e6e7de02.png)
The contract is broken, because two class instances with inst1.field= "AAA" and inst2.field = "aaa" would be equal but with different hashCode().

I propose to create a test case that checks in case equals() fires on strings that differ only on case, hashCode() must be consistent

@jqno
Copy link
Owner

jqno commented Dec 23, 2022

That's a good idea.

I don't have a lot of time to spend on EqualsVerifier these days though, so it might be a little while before I get to it. I'll keep you posted. I'm open to PR's though 🙂

@jqno
Copy link
Owner

jqno commented Feb 16, 2023

I've added the test case in version 3.13.2, which is now syncing with Maven Central!

@jqno jqno closed this as completed Feb 16, 2023
@gsaviane
Copy link
Author

gsaviane commented Feb 16, 2023 via email

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

2 participants