User extends Resource implements UserId { @Override public boolean equals(Object obj) { String pk = getUserId(); if (pk == null || obj == null || !(obj instanceof User)) { return false; } return pk.equals(((User) obj).getUserId()); } User(FlattrObject data); static UserId withId(final String id); @Override String getUserId(); String getIdentifier(); String getUsername(); String getResource(); String getLink(); String getFirstname(); String getLastname(); String getCity(); String getCountry(); String getUrl(); @RequiredScope(Scope.EXTENDEDREAD) String getEmail(); String getDescription(); String getGravatar(); boolean isActiveSupporter(); @RequiredScope(Scope.EXTENDEDREAD) Date getRegisteredAt(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void testEquals() throws FlattrException { User user1 = new User(new FlattrObject("{\"username\":\"simon_g\"}")); User user2 = new User(new FlattrObject("{\"username\":\"simon_g\"}")); User user3 = new User(new FlattrObject("{\"username\":\"sherlock_h\"}")); assertThat(user1, is(equalTo(user2))); assertThat(user2, is(equalTo(user1))); assertThat(user1, not(equalTo(user3))); assertThat(user3, not(equalTo(user1))); }