### Question:
RequireJsBundleListener implements BundleListener { public void init() { this.serviceRegistrationMap = new ConcurrentHashMap<>(); this.requireConfigMap = new ConcurrentHashMap<>(); this.bundleContext.addBundleListener( this ); for ( Bundle bundle : this.bundleContext.getBundles() ) { this.addBundle( bundle ); } }  void setBundleContext( BundleContext bundleContext ); void setRequireJsConfigManager( RequireJsConfigManager requireJsConfigManager ); void init(); void destroy(); Collection<IPlatformPluginRequireJsConfigurations> getScripts(); @Override void bundleChanged( BundleEvent bundleEvent ); boolean removeBundle( Bundle bundle ); static final String EXTERNAL_RESOURCES_JSON_PATH; static final String STATIC_RESOURCES_JSON_PATH; }### Answer:
@Test public void init() { Bundle mockBundleNoClientSide = this.createMockBundle( "non-client-side-bundle", "0.1", Bundle.ACTIVE ); Bundle mockBundleWithPackageJson = this.createMockPackageJsonBundle( "lib1", "1.0", Bundle.ACTIVE ); Bundle mockBundleWithRequireJson = this.createMockRequireJsonBundle( "lib2", "2.0", Bundle.ACTIVE ); Bundle mockBundleWithExternalResources = this.createMockExternalResourcesBundle( "lib3", "3.0", Bundle.ACTIVE ); Bundle mockBundleWithExternalAndStaticResources = this.createMockExternalStaticResourcesBundle( "lib4", "4.0", Bundle.ACTIVE ); Bundle[] mockBundles = new Bundle[ 5 ]; mockBundles[ 0 ] = mockBundleNoClientSide; mockBundles[ 1 ] = mockBundleWithPackageJson; mockBundles[ 2 ] = mockBundleWithRequireJson; mockBundles[ 3 ] = mockBundleWithExternalResources; mockBundles[ 4 ] = mockBundleWithExternalAndStaticResources; doReturn( mockBundles ).when( this.mockBundleContext ).getBundles(); RequireJsBundleListener spyed = spy( new RequireJsBundleListener() ); spyed.setBundleContext( this.mockBundleContext ); spyed.setRequireJsConfigManager( this.mockRequireJsConfigManager ); spyed.init(); verify( this.mockBundleContext, times( 1 ) ).addBundleListener( same( this.requireJsBundleListener ) ); verify( spyed, times( 5 ) ).addBundle( any() ); }