@Test public void shouldNotVerifyConfigurationAndRemoveServiceListenerWhenServiceEventRegisteredIsNotNotified() throws Exception { final ActivatorHelper activatorHelper = mock(ActivatorHelper.class); Activator activator = new Activator() { @Override protected ActivatorHelper getActivatorHelper() { return activatorHelper; } }; BundleContext bundleContext = mock(BundleContext.class); injectBundleContextInto(activator, bundleContext); ServiceEvent serviceEvent = mock(ServiceEvent.class); when(serviceEvent.getType()).thenReturn(ServiceEvent.MODIFIED); activator.serviceChanged(serviceEvent); verify(activatorHelper, never()).verifyConfiguration((ServiceReference)anyObject()); verify(bundleContext, never()).removeServiceListener((ServiceListener)anyObject()); }
@Override public void serviceChanged( ServiceEvent event ) { if (ServiceEvent.REGISTERED == event.getType()) { getActivatorHelper().verifyConfiguration(event.getServiceReference()); bundleContext.removeServiceListener(this); } }
Activator implements BundleActivator, ServiceListener { @Override public void serviceChanged( ServiceEvent event ) { if (ServiceEvent.REGISTERED == event.getType()) { getActivatorHelper().verifyConfiguration(event.getServiceReference()); bundleContext.removeServiceListener(this); } } }
Activator implements BundleActivator, ServiceListener { @Override public void serviceChanged( ServiceEvent event ) { if (ServiceEvent.REGISTERED == event.getType()) { getActivatorHelper().verifyConfiguration(event.getServiceReference()); bundleContext.removeServiceListener(this); } }  }
Activator implements BundleActivator, ServiceListener { @Override public void serviceChanged( ServiceEvent event ) { if (ServiceEvent.REGISTERED == event.getType()) { getActivatorHelper().verifyConfiguration(event.getServiceReference()); bundleContext.removeServiceListener(this); } }  @Override void serviceChanged( ServiceEvent event ); @Override void start( BundleContext bundleContext ); @Override void stop( BundleContext bundleContext ); }
Activator implements BundleActivator, ServiceListener { @Override public void serviceChanged( ServiceEvent event ) { if (ServiceEvent.REGISTERED == event.getType()) { getActivatorHelper().verifyConfiguration(event.getServiceReference()); bundleContext.removeServiceListener(this); } }  @Override void serviceChanged( ServiceEvent event ); @Override void start( BundleContext bundleContext ); @Override void stop( BundleContext bundleContext );  }