### Question:
PlatformDeployerBundleListener implements BundleListener { @Override public void bundleChanged( BundleEvent event ) { switch ( event.getType() ) { case BundleEvent.UNINSTALLED: case BundleEvent.INSTALLED: if ( event.getBundle().getHeaders().get( "Bundle-PlatformPluginName" ) != null ) { String bundleStr = event.getBundle().getHeaders().get( "Bundle-Name" ) + event.getBundle().getHeaders().get( "Bundle-Version" ); log.info( "Received Bundle event : {}", bundleStr + ( ( event.getType() == BundleEvent.INSTALLED ) ? "Installed" : "Uninstalled" ) ); bundleStateManager.setState( bundleStr, event.getType() ); } break; } }  void setBundleContext( BundleContext bundleContext ); void setBundleStateManager( BundleStateManager bundleStateManager ); @Override void bundleChanged( BundleEvent event ); void init();  }### Answer:
@Test public void testBundleInstalled() { when( bundleEvent.getType() ).thenReturn( BundleEvent.INSTALLED ); when( bundleEvent.getBundle().getState() ).thenReturn( BundleEvent.INSTALLED ); platformDeployerBundleListener.bundleChanged( bundleEvent ); assertTrue( bundleStateManager.isBundleInstalled( "common-ui100" ) ); }
@Test public void testBundleUninstalled() { when( bundleEvent.getType() ).thenReturn( BundleEvent.UNINSTALLED ); when( bundleEvent.getBundle().getState() ).thenReturn( BundleEvent.UNINSTALLED ); platformDeployerBundleListener.bundleChanged( bundleEvent ); assertFalse( bundleStateManager.isBundleInstalled( "common-ui100" ) ); }