Id implements Comparable<Id> { public static Id makeRandom() { long lng = RANDOM.nextLong(); return new Id(lng < 0 ? -lng : lng); } private  Id(Long id); static Id makeRandom(); static Id fromString(String id); static Id fromAdId(AdId id); boolean equals(Object obj); int hashCode(); String toString(); AdId toAdId(); Long toLong(); @Override int compareTo(Id another);  }
@Test public void equalsMakesSense() { Id id1 = Id.makeRandom(); assertEquals(id1, id1); }
@Test public void firstRandomIdsNotEqual() { Id id1 = Id.makeRandom(); Id id2 = Id.makeRandom(); assertNotEquals(id1, id2); }