### Question:
RequireJsPackageImpl implements IRequireJsPackage { @Override public URL getScriptResource( String name ) { URL url = null; try { url = this.resourceRoot.resolve( this.scripts.get( name ) ).toURL(); } catch ( MalformedURLException ignored ) { } return url; } 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 testGetScriptResource() { String scriptName = "a"; Map<String, String> expectedScripts = new HashMap<>(); expectedScripts.put( scriptName, "a.js" ); Map<String, Object> scripts = new HashMap<>(); scripts.put( "scripts", expectedScripts ); when( mockPentahoWebPackage.getPackageJson() ).thenReturn( scripts ); this.requireJsPackage = new RequireJsPackageImpl( this.mockPentahoWebPackage, this.resourceRootUri ); assertTrue( this.requireJsPackage.hasScript( scriptName ) ); URL actualScriptResource = this.requireJsPackage.getScriptResource( scriptName ); assertNotNull( actualScriptResource ); assertTrue( actualScriptResource.toExternalForm().endsWith( "/a.js" ) ); }