### Question:
Activator implements BundleActivator { public void stop( BundleContext bundleContext ) { if ( this.pentahoWebPackageServiceTracker != null ) { this.pentahoWebPackageServiceTracker.close(); this.pentahoWebPackageServiceTracker = null; } }  void start( BundleContext bundleContext ); void stop( BundleContext bundleContext );  }### Answer:
@Test public void serviceTrackerIsClosedOnActivatorStop() { ServiceTracker mockServiceTracker = mock( ServiceTracker.class ); activator.pentahoWebPackageServiceTracker = mockServiceTracker; activator.stop( null ); verify( mockServiceTracker, times( 1 ) ).close(); }
@Test public void serviceTrackerIsSetToNullOnActivatorStop() { activator.pentahoWebPackageServiceTracker = mock( ServiceTracker.class ); activator.stop( null ); assertNull( activator.pentahoWebPackageServiceTracker ); }