LikeConstraint implements Constraint { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof LikeConstraint)) { return false; } LikeConstraint that = (LikeConstraint) o; if (lhs != null ? !lhs.equals(that.lhs) : that.lhs != null) { return false; } if (pattern != null ? !pattern.pattern().equals(that.pattern.pattern()) : that.pattern != null) { return false; } return true; } LikeConstraint(String lhs, String rhsRegex); boolean isConstraintOnHostName(); boolean matchesHostName(String hostname); boolean matchesSlaveAttributes(Collection<Attribute> attributes); @Override Type getType(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() throws Exception { assertTrue(constraintOne.equals(constraintTwo)); assertFalse(constraintOne.equals(constraintThree)); }