|
Project Information
Featured
Downloads
Links
|
EqualsVerifierEqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods in a class is met. The contracts are described in the Javadoc comments for the java.lang.Object class. What's new?Check out the Changelog! Quick start
@Test
public void equalsContract() {
EqualsVerifier.forClass(My.class).verify();
}@Test
public void equalsContract() {
EqualsVerifier.forClass(My.class)
.usingGetClass()
.verify();
}@Test
public void equalsContract() {
EqualsVerifier.forClass(My.class)
.suppress(Warning.NONFINAL_FIELDS, Warning.NULL_FIELDS)
.verify();
}When EqualsVerifier detects a problem, it will explain what it thinks is wrong. In some cases (mostly when it needs more information), it will say what to do to fix the problem. Help, I don't understand an error message!Never fear, help is here. Documentation |