@Test public void equals() throws Exception { assertTrue(userGroup1.equals(userGroup1)); assertTrue(userGroup1.equals(userGroup3)); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserGroup group = (UserGroup) o; if (groupId != group.groupId) return false; return name.equals(group.name); }
UserGroup { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserGroup group = (UserGroup) o; if (groupId != group.groupId) return false; return name.equals(group.name); } }
UserGroup { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserGroup group = (UserGroup) o; if (groupId != group.groupId) return false; return name.equals(group.name); } UserGroup(int groupId, String name); }
UserGroup { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserGroup group = (UserGroup) o; if (groupId != group.groupId) return false; return name.equals(group.name); } UserGroup(int groupId, String name); int getGroupId(); void setGroupId(int groupId); String getName(); void setName(String name); boolean isSharingLocation(); void setSharingLocation(boolean sharingLocation); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
UserGroup { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserGroup group = (UserGroup) o; if (groupId != group.groupId) return false; return name.equals(group.name); } UserGroup(int groupId, String name); int getGroupId(); void setGroupId(int groupId); String getName(); void setName(String name); boolean isSharingLocation(); void setSharingLocation(boolean sharingLocation); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }