### Question:
RequireJsPackageImpl implements IRequireJsPackage { @Override public Map<String, Map<String, ?>> getShim() { return Collections.unmodifiableMap( this.shim ); } 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 testGetShimWhenConfigurationIsMap() { String shimName = "someShim"; Map<String, Map<String, String>> expectedShim = new HashMap<>(); Map<String, String> shim = new HashMap<>(); shim.put( "aShimEntry", "path/to/something" ); expectedShim.put( shimName, shim ); Map<String, Object> shims = new HashMap<>(); shims.put( "shim", expectedShim ); when( mockPentahoWebPackage.getPackageJson() ).thenReturn( shims ); this.requireJsPackage = new RequireJsPackageImpl( this.mockPentahoWebPackage, this.resourceRootUri ); Map<String, ?> actualShim = this.requireJsPackage.getShim(); assertTrue( actualShim.containsKey( shimName ) ); }
@Test public void testGetShimWhenConfigurationIsList() { String shimName = "someShim"; Map<String, List<String>> expectedShim = new HashMap<>(); List<String> shim = new ArrayList<>(); shim.add( "Some shim data" ); expectedShim.put( shimName, shim ); Map<String, Object> shims = new HashMap<>(); shims.put( "shim", expectedShim ); when( mockPentahoWebPackage.getPackageJson() ).thenReturn( shims ); this.requireJsPackage = new RequireJsPackageImpl( this.mockPentahoWebPackage, this.resourceRootUri ); Map<String, ?> actualShim = this.requireJsPackage.getShim(); assertTrue( actualShim.containsKey( shimName ) ); }