### Question:
OSGIServiceTracker extends ServiceTracker { @Override public Object addingService( ServiceReference reference ) { references.add( reference ); tracker.serviceChanged( clazzToTrack, LifecycleEvent.START, reference ); Object retVal = super.addingService( reference ); return retVal; } OSGIServiceTracker( OSGIPluginTracker tracker, Class clazzToTrack );  OSGIServiceTracker( OSGIPluginTracker osgiPluginTracker, Class clazzToTrack, boolean asPluginInterface ); @Override Object addingService( ServiceReference
                                 reference ); @Override void removedService( ServiceReference
                                reference, Object service ); @Override void modifiedService( ServiceReference
                                 reference, Object service );  }### Answer:
@Test public void testAddingService() throws InvalidSyntaxException { ServiceReference serviceReference = mock( ServiceReference.class ); Object service = mock( Object.class ); when( bundleContext.getService( serviceReference ) ).thenReturn( service ); Filter filter = mock( Filter.class ); when( bundleContext.createFilter( anyString() ) ).thenReturn( filter ); assertEquals( service, new OSGIServiceTracker( pluginTracker, Object.class ).addingService( serviceReference ) ); verify( pluginTracker ).serviceChanged( Object.class, START, serviceReference ); }