### Question:
IncrementIdGenerator implements IdGenerator { @Override public String newId() { return Integer.toString(nextId++); }  @Override String newId();  }### Answer:
@Test public void testNewId() { IdGenerator idGenerator = new IncrementIdGenerator(); 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 IncrementIdGenerator().newId(); for(int i=0; i < 10; i++) { String newId = new IncrementIdGenerator().newId(); assertFalse(oldId.equals(newId)); oldId = newId; } }