### Question:
Constraint { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + allowedValues.hashCode(); result = prime * result + name.hashCode(); return result; } Constraint(final String name, final String... allowedValue); String getName(); Collection<String> getAllowedValues(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }### Answer:
@Test public void hashCodeTest() { final Constraint constraint = new Constraint("name","av1"); final Constraint sameConstraint = new Constraint("name","av1"); final Constraint anotherConstraint = new Constraint("name2","av"); assertThat(constraint.hashCode(),is(constraint.hashCode())); assertThat(constraint.hashCode(),is(sameConstraint.hashCode())); assertThat(constraint.hashCode(),is(not(anotherConstraint.hashCode()))); assertThat(sameConstraint.hashCode(),is(not(anotherConstraint.hashCode()))); }