ModificationsImpl implements Modifications<T_ITEM>, Cloneable { public void registerAddedItem(T_ITEM item) { if (addedItems.isEmpty()) { addedItems = new ArrayList<T_ITEM>(); } if (!addedItems.contains(item)) { addedItems.add(item); } }  @Override boolean isModified(); @Override List<T_ITEM> getAddedItems(); void registerAddedItem(T_ITEM item); void unregisterAddedItem(T_ITEM item); @Override Collection<T_ITEM> getUpdatedItems(); void registerUpdatedItem(T_ITEM item, boolean isUpdated); @Override Selection<T_ITEM> getRemovedItems(); void setRemovedItems(Selection<T_ITEM> removedItems); @SuppressWarnings("unchecked") @Override ModificationsImpl<T_ITEM> clone(); @Override String toString();  }
@Test public void testRegisterAddedItem() { modifications.registerAddedItem("a"); assertEquals("{added: 1, updated: 0, removed: 0}", modifications.toString()); }