GrantedAuthorityTarget implements Serializable { @Override public boolean equals(Object o) { if (o == this) { return true; } else if ((o != null) && o.getClass().equals(getClass())) { GrantedAuthorityTarget other = (GrantedAuthorityTarget) o; return new EqualsBuilder() .append(other.targetId, targetId) .append(other.type, type) .isEquals(); } return false; } GrantedAuthorityTarget(String targetId, Type type); @Override boolean equals(Object o); @Override int hashCode(); static final String APPLICATION_TARGET_ID; static final GrantedAuthorityTarget APPLICATION; }
@Test public void testEquals() { assertEqualsContract( new GrantedAuthorityTarget("project", Type.PROJECT), new GrantedAuthorityTarget("project", Type.PROJECT), new GrantedAuthorityTarget("project", Type.PROJECT), new GrantedAuthorityTarget("project2", Type.PROJECT)); }