@@ -0,0 +1,2271 @@
+package name.falgout.jeffrey.fx.collections;%0A%0Aimport static org.junit.Assert.assertSame;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0A%0Aimport javafx.beans.InvalidationListener;%0Aimport javafx.beans.Observable;%0Aimport javafx.collections.FXCollections;%0Aimport javafx.collections.ObservableMap;%0Aimport javafx.collections.ObservableSet;%0Aimport javafx.collections.SetChangeListener;%0Aimport javafx.collections.SetChangeListener.Change;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.ArgumentCaptor;%0Aimport org.mockito.Captor;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class ObservableKeySetTest %7B%0A  @Mock InvalidationListener invalidationListener;%0A  @Captor ArgumentCaptor%3CObservable%3E invalidationCaptor;%0A%0A  @Mock SetChangeListener%3CObject%3E listener;%0A  @Captor ArgumentCaptor%3CChange%3C?%3E%3E captor;%0A%0A  Object o1;%0A  Object o2;%0A  Object o3;%0A  ObservableMap%3CObject, Object%3E map;%0A  ObservableSet%3CObject%3E set;%0A%0A  @Before%0A  public void before() %7B%0A    o1 = new Object();%0A    o2 = new Object();%0A    o3 = new Object();%0A    map = FXCollections.observableHashMap();%0A    map.put(o1, 1);%0A    map.put(o2, 2);%0A%0A    set = new ObservableKeySet%3C%3E(map);%0A  %7D%0A%0A  @Test%0A  public void invalidationListenerTest() %7B%0A    set.addListener(invalidationListener);%0A%0A    map.put(o3, 3);%0A    map.remove(o1);%0A%0A    set.removeListener(invalidationListener);%0A%0A    map.remove(o2);%0A%0A    verify(invalidationListener, times(2)).invalidated(invalidationCaptor.capture());%0A    assertSame(set, invalidationCaptor.getAllValues().get(0));%0A    assertSame(set, invalidationCaptor.getAllValues().get(1));%0A  %7D%0A%0A  @Test%0A  public void setChangeListener() %7B%0A    set.addListener(listener);%0A%0A    map.put(o3, 3);%0A    map.remove(o2);%0A    map.put(o1, 4);%0A%0A    set.removeListener(listener);%0A%0A    map.remove(o1);%0A%0A    verify(listener, times(2)).onChanged(captor.capture());%0A    assertTrue(captor.getAllValues().get(0).wasAdded());%0A    assertSame(o3, captor.getAllValues().get(0).getElementAdded());%0A%0A    assertTrue(captor.getAllValues().get(1).wasRemoved());%0A    assertSame(o2, captor.getAllValues().get(1).getElementRemoved());%0A  %7D%0A%7D%0A

Add a test for mapped listeners