Sunday, July 15, 2012

Test your equals() easily!

Today I found brilliant tool which makes boring (but valuable) testing of equals() and hashCode() contracts chip and fun for my Java classes. It is equalsverifier project.
Now testing thorough equals/hashCode testing is as simple as this
@Test
public void equalsContract() {
    EqualsVerifier.forClass(My.class).verify();
}

No comments:

Post a Comment