### Question:
MetaInfRequireJson implements IRequireJsPackage { @Override public Map<String, String> getDependencies() { return Collections.unmodifiableMap( this.dependencies ); } MetaInfRequireJson( Map<String, Object> requireJsonObject ); @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 ); URL getScriptResource( String name ); @Override Map<String, Map<String, ?>> getConfig(); @Override Map<String, Map<String, String>> getMap(); @Override Map<String, Map<String, ?>> getShim(); boolean isAmdPackage(); String getExports();  }### Answer:
@Test public void getDependencies() { MetaInfRequireJson requireJson = new MetaInfRequireJson( requireMeta ); final Map<String, String> dependencies = requireJson.getDependencies(); assertEquals( TEST_FILE_BASE_NUMBER_OF_DEPS, dependencies.size() ); }
@Test public void testOverridesAddDependency() { final Map<String, Object> meta = (Map<String, Object>) requireMeta.get( "requirejs-osgi-meta" ); Map<String, Object> overrides = new HashMap<>(); final HashMap<String, Object> dependencies = new HashMap<>(); overrides.put( "dependencies", dependencies ); dependencies.put( "newDependency", "1.2" ); meta.put( "overrides", overrides ); MetaInfRequireJson requireJson = new MetaInfRequireJson( requireMeta ); final Map<String, String> deps = requireJson.getDependencies(); assertEquals( TEST_FILE_BASE_NUMBER_OF_DEPS + 1, deps.size() ); assertTrue( deps.containsKey( "newDependency" ) ); assertEquals( "1.2", deps.get( "newDependency" ) ); }
@Test public void testOverridesRemoveDependency() { final Map<String, Object> meta = (Map<String, Object>) requireMeta.get( "requirejs-osgi-meta" ); Map<String, Object> overrides = new HashMap<>(); final HashMap<String, Object> dependencies = new HashMap<>(); overrides.put( "dependencies", dependencies ); dependencies.put( "angular", null ); meta.put( "overrides", overrides ); MetaInfRequireJson requireJson = new MetaInfRequireJson( requireMeta ); final Map<String, String> deps = requireJson.getDependencies(); assertEquals( TEST_FILE_BASE_NUMBER_OF_DEPS - 1, deps.size() ); assertFalse( deps.containsKey( "angular" ) ); }
@Test public void testOverridesReplacesDependency() { final Map<String, Object> meta = (Map<String, Object>) requireMeta.get( "requirejs-osgi-meta" ); Map<String, Object> overrides = new HashMap<>(); final HashMap<String, Object> dependencies = new HashMap<>(); overrides.put( "dependencies", dependencies ); dependencies.put( "angular", "9.8" ); meta.put( "overrides", overrides ); MetaInfRequireJson requireJson = new MetaInfRequireJson( requireMeta ); final Map<String, String> deps = requireJson.getDependencies(); assertEquals( TEST_FILE_BASE_NUMBER_OF_DEPS, deps.size() ); assertEquals( "9.8", deps.get( "angular" ) ); }