### Question:
DirtySet extends SetDecorator<E> { @Override public boolean remove(final Object o) { if (super.remove(o)) { listener.onElementsRemoved(); return true; } return false; } DirtySet(final Set<E> set, final DirtyListener listener); @Override Iterator<E> iterator(); @Override boolean remove(final Object o); @Override boolean removeAll(final Collection<?> c); @Override boolean retainAll(final Collection<?> c); @Override void clear();  }### Answer:
@Test public void shouldNotifyListenerWhenRemoveIsCalled() throws Exception { dirtySet.remove("one"); verify(listener).onElementsRemoved(); assertThat(dirtySet).containsOnly("two", "three"); }
@Test public void shouldNotNotifyListenerWhenRemoveIsCalledWithNoActualChanges() throws Exception { dirtySet.remove("four"); verifyZeroInteractions(listener); assertThat(dirtySet).containsOnly("one", "two", "three"); }