@Test public void messageIdEquality() { MessageId one = new MessageId("msg1"); MessageId oneDup = new MessageId("msg1"); MessageId two = new MessageId("msg2"); assertEquals(one, oneDup); assertFalse(one.equals(two)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MessageId)) { return false; } MessageId other = (MessageId) obj; return id.equals(other.id); }
MessageId { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MessageId)) { return false; } MessageId other = (MessageId) obj; return id.equals(other.id); } }
MessageId { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MessageId)) { return false; } MessageId other = (MessageId) obj; return id.equals(other.id); } MessageId();  MessageId(String id); }
MessageId { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MessageId)) { return false; } MessageId other = (MessageId) obj; return id.equals(other.id); } MessageId();  MessageId(String id); String getId(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
MessageId { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MessageId)) { return false; } MessageId other = (MessageId) obj; return id.equals(other.id); } MessageId();  MessageId(String id); String getId(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }