How to write a good
equals method, and to test it with EqualsVerifier.
Did you know your equals method can contain bugs, even if you have it generated by your IDE?
I will show you how to recognise these potential bugs, and why you should care about them. You will see how to craft an ironclad equals method. Also, you will see how to test your equals method and gain 100% coverage with a single line of test code, using EqualsVerifier. Because testing equals shouldn’t have to take pages of code.
Show me the code!
- All code can be found on github