@Test public void equals() throws Exception { assertTrue(groupMembership1.equals(groupMembership1)); assertTrue(groupMembership1.equals(groupMembership3)); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GroupMembership that = (GroupMembership) o; if (userId != that.userId) return false; return groupId == that.groupId; }
GroupMembership { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GroupMembership that = (GroupMembership) o; if (userId != that.userId) return false; return groupId == that.groupId; } }
GroupMembership { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GroupMembership that = (GroupMembership) o; if (userId != that.userId) return false; return groupId == that.groupId; } GroupMembership(int userId, int groupId); }
GroupMembership { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GroupMembership that = (GroupMembership) o; if (userId != that.userId) return false; return groupId == that.groupId; } GroupMembership(int userId, int groupId); int getUserId(); void setUserId(int userId); int getGroupId(); void setGroupId(int groupId); Date getSharingUntil(); void setSharingUntil(Date sharingUntil); boolean isSharing(); void setSharing(boolean sharing); @Override boolean equals(Object o); @Override int hashCode(); }
GroupMembership { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GroupMembership that = (GroupMembership) o; if (userId != that.userId) return false; return groupId == that.groupId; } GroupMembership(int userId, int groupId); int getUserId(); void setUserId(int userId); int getGroupId(); void setGroupId(int groupId); Date getSharingUntil(); void setSharingUntil(Date sharingUntil); boolean isSharing(); void setSharing(boolean sharing); @Override boolean equals(Object o); @Override int hashCode();  }