}
// Javadoc inherited.
public void testEqualsAndHashcodeImplementedCorrectly() {
MutableMinimumLengthConstraint minimumLengthConstraint1 =
(MutableMinimumLengthConstraint) getMutableInhibitor();
MutableMinimumLengthConstraint minimumLengthConstraint2 =
(MutableMinimumLengthConstraint) getMutableInhibitor();
// ensure that the two objects are equal
assertEquals("Object 1 should be equal to object 2",
minimumLengthConstraint1, minimumLengthConstraint2);
// ensure that they have the same hash code
int hashCode1 = minimumLengthConstraint1.hashCode();
int hashCode2 = minimumLengthConstraint2.hashCode();
assertTrue("Objects which are equal should have the same hash codes. " +
"Were : " + hashCode1 + " and " + hashCode2,
hashCode1 == hashCode2);
// now change the externally visible field and ensure that the two
// objects are different
minimumLengthConstraint2.setLimit(1);
assertNotEquals(minimumLengthConstraint1, minimumLengthConstraint2);
// see if the hashcodes are different
hashCode1 = minimumLengthConstraint1.hashCode();
hashCode2 = minimumLengthConstraint2.hashCode();
assertFalse("Objects which are not equal should ideally not have the " +
"same hash codes. Were : " + hashCode1 + " and " + hashCode2,
hashCode1 == hashCode2);
}