@Test
public void testClearTracker() throws Exception {

    LocalDiscovery ld = new LocalDiscovery();
    EndpointEventListener endpointListener = EasyMock.createMock(EndpointEventListener.class);
    ld.listenerToFilters.put(endpointListener,
        new ArrayList<>(Arrays.asList("(a=b)", "(objectClass=foo.bar.Bheuaark)")));
    ld.filterToListeners.put("(a=b)", new ArrayList<>(Arrays.asList(endpointListener)));
    ld.filterToListeners.put("(objectClass=foo.bar.Bheuaark)",
        new ArrayList<>(Arrays.asList(endpointListener)));
    assertEquals(1, ld.listenerToFilters.size());
    assertEquals(2, ld.filterToListeners.size());
    assertEquals(1, ld.filterToListeners.values().iterator().next().size());
    ld.unbindListener(EasyMock.createMock(EndpointEventListener.class));
    assertEquals(1, ld.listenerToFilters.size());
    assertEquals(2, ld.filterToListeners.size());
    assertEquals(1, ld.filterToListeners.values().iterator().next().size());
    ld.unbindListener(endpointListener);
    assertEquals(0, ld.listenerToFilters.size());
    assertEquals(0, ld.filterToListeners.size());
}