public void testHashCode() throws Exception { SimpleConstraint c1 = new SimpleConstraint(qeNum1, ConstraintOp.EQUALS, qeNum1); SimpleConstraint c2 = new SimpleConstraint(qeNum1, ConstraintOp.EQUALS, qeNum1); SimpleConstraint c3 = new SimpleConstraint(qeStr1, ConstraintOp.EQUALS, qeStr2); SimpleConstraint c4 = new SimpleConstraint(qeStr1, ConstraintOp.EQUALS, qeStr2); c4.negate(); assertEquals(c1.hashCode(), c1.hashCode()); assertEquals(c1.hashCode(), c2.hashCode()); assertTrue("Expected c1 hashCode() to not equal c3.hashCode():", c1.hashCode() != c3.hashCode()); assertTrue("Expected c3.hashCode() to not equal c4.hashCode():", c3.hashCode() != c4.hashCode()); } }