Source:
<code>public void setup() throws Exception { this.baseUrl = "/default/base/url/"; this.mockContextBundle = mock( Bundle.class ); this.mockBundleCounter = 1L; this.mockBundles = new Bundle[6]; <START> this.mockBundles[0] = this.createMockBundle( "non-client-side-bundle", "0.1", Bundle.ACTIVE ); <END> 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(); }</code><technical_language>I mocks in array, code more readable a named variable for of bundle mocks? This is more evident array in tests. For example, is this mock supposed represent? Bundle mockBundle = this.mockBundles[5]; If a named variable externalStaticResourcesBundleMock instead of this.mockBundles[5] test conditions easier understand. Is array iterated somewhere</technical_language>

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