The verifications are inspired by:
- Effective Java, Second Edition by Joshua Bloch, Addison-Wesley, 2008: Items 8 (Obey the general contract when overriding
equals) and 9 (Always override
hashCodewhen you override
- Programming in Scala by Martin Odersky, Lex Spoon and Bill Venners, Artima Press, 2008: Chapter 28 (Object equality) / Second Edition, 2011: Chapter 30 (Object equality). A Java-centric version of this chapter can be found online here.
- JUnit Recipes by J.B. Rainsberger, Manning, 2005: Appendix B.2 (Strangeness and transitivity).
- How Do I Correctly Implement the equals() Method? by Tal Cohen, Dr. Dobb’s Journal, May 2002. Read the article and Cohen’s follow-up.
And of course GSBase’s
EqualsTester by Mike Bowler, Gargoyle Software, which I think is pretty good, but lacking with respect to inheritance. Also, it requires that examples be given, while EqualsVerifier can auto-generate them in most cases (which, of course, is way cool). You can find it on SourceForge.