@Test public void equalsWithSameIDsAndDifferentNames() { UserPrincipal testUserPrincipal1 = createTestUserPrincipal(TEST_ID, TEST_USERNAME); UserPrincipal testUserPrincipal2 = createTestUserPrincipal(TEST_ID, "test1"); assertFalse(testUserPrincipal1.equals(testUserPrincipal2)); }
@Override public boolean equals(Object obj) { if (!(obj instanceof UserPrincipal)) { return false; } if (this == obj) { return true; } UserPrincipal rhs = (UserPrincipal) obj; return new EqualsBuilder().appendSuper(super.equals(obj)).append(user.getId(), rhs.user.getId()).isEquals(); }
UserPrincipal extends AbstractPrincipal { @Override public boolean equals(Object obj) { if (!(obj instanceof UserPrincipal)) { return false; } if (this == obj) { return true; } UserPrincipal rhs = (UserPrincipal) obj; return new EqualsBuilder().appendSuper(super.equals(obj)).append(user.getId(), rhs.user.getId()).isEquals(); } }
UserPrincipal extends AbstractPrincipal { @Override public boolean equals(Object obj) { if (!(obj instanceof UserPrincipal)) { return false; } if (this == obj) { return true; } UserPrincipal rhs = (UserPrincipal) obj; return new EqualsBuilder().appendSuper(super.equals(obj)).append(user.getId(), rhs.user.getId()).isEquals(); } UserPrincipal(PLCUser user); }
UserPrincipal extends AbstractPrincipal { @Override public boolean equals(Object obj) { if (!(obj instanceof UserPrincipal)) { return false; } if (this == obj) { return true; } UserPrincipal rhs = (UserPrincipal) obj; return new EqualsBuilder().appendSuper(super.equals(obj)).append(user.getId(), rhs.user.getId()).isEquals(); } UserPrincipal(PLCUser user); PLCUser getUser(); @Override String getName(); @Override int hashCode(); @Override boolean equals(Object obj); }
UserPrincipal extends AbstractPrincipal { @Override public boolean equals(Object obj) { if (!(obj instanceof UserPrincipal)) { return false; } if (this == obj) { return true; } UserPrincipal rhs = (UserPrincipal) obj; return new EqualsBuilder().appendSuper(super.equals(obj)).append(user.getId(), rhs.user.getId()).isEquals(); } UserPrincipal(PLCUser user); PLCUser getUser(); @Override String getName(); @Override int hashCode(); @Override boolean equals(Object obj);  }