@Test public void mutationsTriggerDetach() { when(allowDetach.getAsBoolean()).thenReturn(true); underTest.put("foo", "bar"); underTest.clear(); underTest.remove("foo"); InOrder inOrder = inOrder(backing, allowDetach, detach); inOrder.verify(allowDetach).getAsBoolean(); inOrder.verify(backing).size(); inOrder.verify(backing).entrySet(); verifyNoMoreInteractions(backing, allowDetach, detach); }
@Override public int size() { return backing.size(); }
DetachingMap extends ForwardingMap<K, V> { @Override public int size() { return backing.size(); } }
DetachingMap extends ForwardingMap<K, V> { @Override public int size() { return backing.size(); } DetachingMap(final Map<K, V> backing, final BooleanSupplier allowDetach, final Function<V, V> detach);  DetachingMap(final Map<K, V> backing, final Function<V, V> detach); }
DetachingMap extends ForwardingMap<K, V> { @Override public int size() { return backing.size(); } DetachingMap(final Map<K, V> backing, final BooleanSupplier allowDetach, final Function<V, V> detach);  DetachingMap(final Map<K, V> backing, final Function<V, V> detach); @Override boolean containsKey(final Object key); @Override boolean containsValue(final Object value); @Override boolean isEmpty(); @Override int size(); @Override boolean equals(final Object object); @Override int hashCode(); @Override String toString(); }
DetachingMap extends ForwardingMap<K, V> { @Override public int size() { return backing.size(); } DetachingMap(final Map<K, V> backing, final BooleanSupplier allowDetach, final Function<V, V> detach);  DetachingMap(final Map<K, V> backing, final Function<V, V> detach); @Override boolean containsKey(final Object key); @Override boolean containsValue(final Object value); @Override boolean isEmpty(); @Override int size(); @Override boolean equals(final Object object); @Override int hashCode(); @Override String toString();  }