### Question:
ObjectIdFactory { public synchronized ObjectId idFor(Object value) { int idHash = System.identityHashCode(value); List<ObjectIdEntry> list = getObjectIdList(idHash); for (ObjectIdEntry e : list) { if (e.object == value) { return e.id; } } ObjectId id = new ObjectId(counter++); list.add(new ObjectIdEntry(value, id)); return id; }  synchronized ObjectId idFor(Object value);  }### Answer:
@Test public void validateIdFactory() { ObjectIdFactory factory = new ObjectIdFactory(); ObjectId a=factory.idFor("HA"); ObjectId b=factory.idFor("HA"); assertEquals(a, b); a=factory.idFor(new String("HA")); b=factory.idFor(new String("HA")); assertFalse(a.equals(b)); }