NamedUuid { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof NamedUuid)) { return false; } NamedUuid that = (NamedUuid) other; return Objects.equals(uuidName, that.uuidName); } NamedUuid(String uuidName); String getUuidName(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); final String namedUuidString; }
@Test public void testEquals() { new EqualsTester() .addEqualityGroup(new NamedUuid("uuid-name"), new NamedUuid("uuid-name")) .testEquals(); }