### Question:
DirtyCollection implements Collection<E> { @Override public boolean removeAll(final Collection<?> c) { if (delegate.removeAll(c)) { listener.onElementsRemoved(); return true; } return false; } DirtyCollection(final Collection<E> delegate, final DirtyListener listener); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(final Object o); @Override Iterator<E> iterator(); @Override Object[] toArray(); @Override T[] toArray(final T[] a); @Override boolean add(final E e); @Override boolean remove(final Object o); @Override boolean containsAll(final Collection<?> c); @Override boolean addAll(final Collection<? extends E> c); @Override boolean removeAll(final Collection<?> c); @Override boolean retainAll(final Collection<?> c); @Override void clear(); @Override boolean equals(final Object o); @Override int hashCode();  }### Answer:
@Test public void shouldNotifyListenerWhenRemoveAllIsCalled() throws Exception { collection.removeAll(Arrays.asList("one", "three")); verify(listener).onElementsRemoved(); assertThat(collection).containsOnly("two"); }
@Test public void shouldNotNotifyListenerWhenRemoveAllIsCalledWithNoActualChanges() throws Exception { collection.removeAll(Arrays.asList("four")); verifyZeroInteractions(listener); assertThat(collection).containsOnly("one", "two", "three"); }