Ray Milkey

Add equals() methods because hashCode() was defined

These are reported as 'Blocker' bugs by SonarQube

Change-Id: I6c25e365522f26e9f50b67a57878ad75c42aa9d2
......@@ -49,6 +49,20 @@ public class Leadership {
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Leadership) {
final Leadership other = (Leadership) obj;
return Objects.equals(this.topic, other.topic) &&
Objects.equals(this.leader, other.leader) &&
Objects.equals(this.epoch, other.epoch);
}
return false;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this.getClass())
.add("topic", topic)
......
......@@ -77,6 +77,20 @@ public class LeadershipEvent extends AbstractEvent<LeadershipEvent.Type, Leaders
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LeadershipEvent) {
final LeadershipEvent other = (LeadershipEvent) obj;
return Objects.equals(this.type(), other.type()) &&
Objects.equals(this.subject(), other.subject()) &&
Objects.equals(this.time(), other.time());
}
return false;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this.getClass())
.add("type", type())
......