### Question:
UUIDIdGenerator implements IdGenerator { @Override public String newId() { return UUID.randomUUID().toString(); }  @Override String newId();  }### Answer:
@Test public void testNewId() { IdGenerator idGenerator = new UUIDIdGenerator(); String oldId = idGenerator.newId(); for (int i = 0; i < 10; i++) { String newId = idGenerator.newId(); assertFalse(oldId.equals(newId)); oldId = newId; } }
@Test public void testNewIdDifferentInstances() { String oldId = new UUIDIdGenerator().newId(); for (int i = 0; i < 10; i++) { String newId = new UUIDIdGenerator().newId(); assertFalse(oldId.equals(newId)); oldId = newId; } }