### Question:
DirtySet extends SetDecorator<E> { @Override public void clear() { super.clear(); listener.onElementsRemoved(); } 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 shouldNotifyListenerWhenClearIsCalled() throws Exception { dirtySet.clear(); verify(listener).onElementsRemoved(); assertThat(dirtySet).isEmpty(); }