### Question:
RequireJsPackageImpl implements IRequireJsPackage { @Override public boolean preferGlobal() { return this.preferGlobal; } RequireJsPackageImpl( IPentahoWebPackage pentahoWebPackage, URI resourceRoot ); @Override String getName(); @Override String getVersion(); @Override String getWebRootPath(); @Override boolean preferGlobal(); @Override Map<String, String> getModules(); @Override String getModuleMainFile( String moduleId ); @Override Map<String, String> getDependencies(); @Override boolean hasScript( String name ); @Override URL getScriptResource( String name ); @Override Map<String, Map<String, ?>> getConfig(); @Override Map<String, Map<String, String>> getMap(); @Override Map<String, Map<String, ?>> getShim();  }### Answer:
@Test public void testPreferGlobal() { boolean expectedPreferGlobal = true; Map<String, Object> preferGlobalJson = new HashMap<>(); preferGlobalJson.put( "preferGlobal", expectedPreferGlobal ); when( mockPentahoWebPackage.getPackageJson() ).thenReturn( preferGlobalJson ); this.requireJsPackage = new RequireJsPackageImpl( this.mockPentahoWebPackage, this.resourceRootUri ); boolean actualPreferGlobal = this.requireJsPackage.preferGlobal(); assertEquals( "Should return true", expectedPreferGlobal, actualPreferGlobal ); }