### Question:
BeanFactoryLookupServiceTracker extends ServiceTracker { @Override public Object addingService( ServiceReference reference ) { osgiPluginTracker.setBeanFactoryLookup( (BeanFactoryLocator) context.getService( reference ) ); return reference; } BeanFactoryLookupServiceTracker( BundleContext bundleContext, OSGIPluginTracker osgiPluginTracker ); @Override Object addingService( ServiceReference reference );  }### Answer:
@Test public void testAddingService() { BundleContext bundleContext = mock( BundleContext.class ); OSGIPluginTracker osgiPluginTracker = mock( OSGIPluginTracker.class ); BeanFactoryLookupServiceTracker tracker = new BeanFactoryLookupServiceTracker( bundleContext, osgiPluginTracker ); ServiceReference serviceReference = mock( ServiceReference.class ); BeanFactoryLocator service = mock( BeanFactoryLocator.class ); when( bundleContext.getService( serviceReference ) ).thenReturn( service ); assertEquals( serviceReference, tracker.addingService( serviceReference ) ); verify( osgiPluginTracker ).setBeanFactoryLookup( service ); }