### Question:
DenialConstraint implements Result { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((predicates == null) ? 0 : predicates.hashCode()); return result; } DenialConstraint();  DenialConstraint(Predicate... predicates); @Override void sendResultTo(OmniscientResultReceiver resultReceiver); Collection<Predicate> getPredicates(); @JsonIgnore int getPredicateCount(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final String NOT; static final String AND; }### Answer:
@Test public void testEqualsHashCode() { Predicate p1 = mock(Predicate.class); Predicate p2 = mock(Predicate.class); Predicate p3 = mock(Predicate.class); DenialConstraint expectedDC = new DenialConstraint(p1, p2); DenialConstraint expectedEqualDC = new DenialConstraint(p2, p1); DenialConstraint expectedNotEqualDC = new DenialConstraint(p1, p2, p3); assertEquals(expectedDC, expectedDC); assertEquals(expectedDC.hashCode(), expectedDC.hashCode()); assertEquals(expectedDC, expectedEqualDC); assertEquals(expectedDC.hashCode(), expectedEqualDC.hashCode()); assertNotEquals(expectedDC, expectedNotEqualDC); assertNotEquals(expectedDC.hashCode(), expectedNotEqualDC.hashCode()); }