RoleGrantedAuthority implements GrantedAuthority { @Override public int hashCode() { return new HashCodeBuilder() .append(target) .append(roleName) .toHashCode(); } RoleGrantedAuthority(GrantedAuthorityTarget target, String roleName); @Override String getAuthority(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testHashCode() { assertHashCodeContract( new RoleGrantedAuthority( new GrantedAuthorityTarget("project", Type.PROJECT), "admin"), new RoleGrantedAuthority( new GrantedAuthorityTarget("project", Type.PROJECT), "admin")); }