  @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();

    // check that the bundle listener is registered
    verify( this.mockBundleContext, times( 1 ) ).addBundleListener( same( this.requireJsBundleListener ) );

    // check it adds already started bundles
    verify( spyed, times( 5 ) ).addBundle( any() );
  }