### Question:
HashUID extends UID { @Override public boolean equals(Object other) { if (!(other instanceof HashUID)) { return false; } if (other == this) { return true; } HashUID o = (HashUID) other; EqualsBuilder equals = new EqualsBuilder(); equals.append(this.optionalPrefix, o.optionalPrefix); equals.append(this.h1, o.h1); equals.append(this.h2, o.h2); equals.append(this.time, o.time); equals.append(this.extra, o.extra); return equals.isEquals(); } protected  HashUID(); protected  HashUID(final byte[] data, final Date time); protected  HashUID(final byte[] data, final Date time, final String... extras); protected  HashUID(final HashUID template, final String... extras); private  HashUID(final String optionalPrefix, int h1, int h2, int time, final String... extras); private  HashUID(final String optionalPrefix, int h1, int h2, int time); @SuppressWarnings({"unchecked", "rawtypes"}) static UIDBuilder<UID> builder(); @Override int compareTo(final UID uid); @Override boolean equals(Object other); String getBaseUid(); int getH0(); int getH1(); int getH2(); String getShardedPortion(); int getTime(); @Override int hashCode(); @SuppressWarnings({"unchecked", "rawtypes"}) static UIDBuilder<UID> newBuilder(final Date time); @SuppressWarnings("unchecked") static HashUID parse(String s); @SuppressWarnings("unchecked") static HashUID parse(String s, int maxExtraParts); @SuppressWarnings("unchecked") static HashUID parseBase(String s); void readFields(DataInput in); @Override String toString();  }### Answer:
@Test public void testEquals() { UID a = new HashUID(data.getBytes(), (Date) null) {}; UID b = new HashUID(data.getBytes(), (Date) null) {}; assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertTrue(a.getExtra() == null); a = new HashUID(data.getBytes(), null, "blabla.blabla.blabla") {}; b = new HashUID(data.getBytes(), null, "blabla.blabla.blabla") {}; assertEquals(a, b); assertEquals(b, a); assertEquals(a.hashCode(), b.hashCode()); assertTrue(a.getExtra().equals("blabla.blabla.blabla")); }
@Test public void testDifference() { UID a = new HashUID(data.getBytes(), (Date) null) {}; UID b = new HashUID(data2.getBytes(), (Date) null) {}; assertTrue(!a.equals(b)); assertTrue(!b.equals(a)); a = new HashUID(data.getBytes(), null, "blabla.blabla.blabla.blabla.blabla.blabla.blabla") {}; b = new HashUID(data2.getBytes(), null, "blabla.blabla.blabla.blabla.blabla.blabla.blabla") {}; assertTrue(!a.equals(b)); assertTrue(!b.equals(a)); a = new HashUID(data.getBytes(), null, "blabla.blabla.blabla.blabla.blabla.blabla.blabla") {}; b = new HashUID(data.getBytes(), null, "blebla.blabla.blabla.blabla.blabla.blabla.blabla") {}; assertTrue(!a.equals(b)); assertTrue(!b.equals(a)); }