Uuid { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Uuid)) { return false; } Uuid that = (Uuid) other; return Objects.equals(uuid, that.getUuid()); } Uuid(UUID uuid); static Uuid of(UUID uuid); UUID getUuid(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); final String uuidString; }
@Test public void testEquals() { new EqualsTester().addEqualityGroup(uuid, Uuid.of(uuid.getUuid())).testEquals(); }