### Question:
Constraint { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Constraint)) { return false; } final Constraint other = (Constraint) obj; if (!allowedValues.equals(other.allowedValues)) { return false; } if (!name.equals(other.name)) { return false; } return true; } 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 equalsTest() { final Constraint constraint = new Constraint("name","av1"); final Constraint sameConstraint = new Constraint("name","av1"); final Constraint anotherConstraint = new Constraint("name2","av"); final Constraint withOtherNameButSameValues = new Constraint("name2","av1"); assertThat(constraint.equals(constraint), is(true)); assertThat(constraint.equals(null), is(false)); assertThat(constraint.equals(new Object()), is(false)); assertThat(constraint.equals(sameConstraint), is(true)); assertThat(constraint.equals(anotherConstraint), is(false)); assertThat(constraint.equals(withOtherNameButSameValues), is(false)); }