UUIDTimeoutId implements TimeoutId, Serializable { @Override public boolean equals(final Object obj) { boolean isEqual = false; if (this == obj) { isEqual = true; } else if (obj instanceof UUIDTimeoutId) { isEqual = id.equals(((UUIDTimeoutId) obj).id); } return isEqual; } UUIDTimeoutId(final UUID id); static UUIDTimeoutId generateNewId(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }
@Test public void equals_twoDifferentInstancesSameId_returnsTrue() { UUID uuid = UUID.randomUUID(); UUIDTimeoutId instance1 = new UUIDTimeoutId(uuid); UUIDTimeoutId instance2 = new UUIDTimeoutId(uuid); boolean isEqual = instance1.equals(instance2); assertThat("Expected ids to be equal.", isEqual, equalTo(true)); }