SyncConfigTracker extends ServiceTracker { @Override public void removedService(ServiceReference reference, Object service) { enablingRefs.remove(reference); isEnabled = !enablingRefs.isEmpty(); super.removedService(reference, service); } SyncConfigTracker(@NotNull BundleContext context, @NotNull SyncHandlerMappingTracker mappingTracker); @Override Object addingService(ServiceReference reference); @Override void modifiedService(ServiceReference reference, Object service); @Override void removedService(ServiceReference reference, Object service);  }
@Test public void testRemovedService() { when(ref.getProperty(PARAM_USER_DYNAMIC_MEMBERSHIP)).thenReturn(true); tracker.addingService(ref); tracker.removedService(ref, service); assertFalse(tracker.isEnabled()); }