Source:
public void setup() throws Exception { this.baseUrl = "/default/base/url/"; this.mockContextBundle = mock( Bundle.class ); this.mockBundleCounter = 1L; this.mockBundles = new Bundle[6]; this.mockBundles[0] = this.createMockBundle( "non-client-side-bundle", "0.1", Bundle.ACTIVE ); this.mockBundles[1] = this.createMockPackageJsonBundle( "lib1", "1.0", Bundle.ACTIVE ); this.mockBundles[2] = this.createMockRequireJsonBundle( "lib2", "2.0", Bundle.ACTIVE ); this.mockBundles[3] = this.createMockExternalResourcesBundle( "lib3", "3.0", Bundle.ACTIVE ); this.mockBundles[4] = this.createMockExternalStaticResourcesBundle( "lib4", "4.0", Bundle.ACTIVE ); List<BundleCapability> capabilities = new ArrayList<>(); capabilities.add( createMockWebPackageCapability( "/pentaho-webpackage-1a" ) ); capabilities.add( createMockWebPackageCapability( "/pentaho-webpackage-1b" ) ); capabilities.add( createMockWebPackageCapability( "/pentaho-webpackage-1c" ) ); this.mockBundles[5] = this.createMockWebPackageBundle( capabilities,"pentaho-webpackage-1", "1.0", Bundle.ACTIVE ); this.mockBundleContext = mock( BundleContext.class ); when( this.mockBundleContext.getBundle() ).thenReturn( this.mockContextBundle ); when( this.mockBundleContext.getBundles() ).thenReturn( this.mockBundles ); this.requireJsConfigManager = spy( new RequireJsConfigManager() ); this.requireJsConfigManager.setBundleContext( this.mockBundleContext ); this.requireJsConfigManager.init(); }

Target:
public void setup() throws Exception { this.baseUrl = "/default/base/url/"; this.mockContextBundle = mock( Bundle.class ); this.mockBundleCounter = 1L; this.mockBundleNoClientSide = this.createMockBundle( "non-client-side-bundle", "0.1", Bundle.ACTIVE ); this.mockBundleWithPackageJson = this.createMockPackageJsonBundle( "lib1", "1.0", Bundle.ACTIVE ); this.mockBundleWithRequireJson = this.createMockRequireJsonBundle( "lib2", "2.0", Bundle.ACTIVE ); this.mockBundleWithExternalResources = this.createMockExternalResourcesBundle( "lib3", "3.0", Bundle.ACTIVE ); this.mockBundleWithExternalAndStaticResources = this.createMockExternalStaticResourcesBundle( "lib4", "4.0", Bundle.ACTIVE ); List<BundleCapability> capabilities = new ArrayList<>(); capabilities.add( createMockWebPackageCapability( "/pentaho-webpackage-1a" ) ); capabilities.add( createMockWebPackageCapability( "/pentaho-webpackage-1b" ) ); capabilities.add( createMockWebPackageCapability( "/pentaho-webpackage-1c" ) ); this.mockBundleWebPackage = this.createMockWebPackageBundle( capabilities, "pentaho-webpackage-1", "1.0", Bundle.ACTIVE ); Bundle[] mockBundles = new Bundle[6]; mockBundles[0] = this.mockBundleNoClientSide; mockBundles[1] = this.mockBundleWithPackageJson; mockBundles[2] = this.mockBundleWithRequireJson; mockBundles[3] = this.mockBundleWithExternalResources; mockBundles[4] = this.mockBundleWithExternalAndStaticResources; mockBundles[5] = this.mockBundleWebPackage; this.mockBundleContext = mock( BundleContext.class ); when( this.mockBundleContext.getBundle() ).thenReturn( this.mockContextBundle ); when( this.mockBundleContext.getBundles() ).thenReturn( mockBundles ); this.requireJsConfigManager = spy( new RequireJsConfigManager() ); this.requireJsConfigManager.setBundleContext( this.mockBundleContext ); this.requireJsConfigManager.init(); }