ParameterDependencyGraph { void addDependency( String parameter, String downstream ) { Set<String> deps = dependencyGraph.computeIfAbsent( parameter, k -> new LinkedHashSet<>() ); deps.add( downstream ); } ParameterDependencyGraph( final MasterReport report,
                                   final Map<String, ParameterDefinitionEntry> reportParameter,
                                   final ParameterContext parameterContext,
                                   final Map<String, Object> computedParameterValues );   ParameterDependencyGraph( String... allParameterNames ); LinkedHashMap<String, Set<String>> getDependencyGraph(); void setDependencyGraph( LinkedHashMap<String, Set<String>> arg ); Set<String> getAllParameterNames(); void setAllParameterNames( Set<String> allParameterNames ); Set<String> getDependentParameterFor( String parameterName ); Set<String> getAllDependencies( String... parameterNames ); Set<String> getAllDependencies( Iterable<String> parameterNames ); Set<String> getKnownParameter(); boolean doesDependencyExist( String parameterName ); boolean areAllParametersProcessed();  }
@Test public void testAddDependency() { ParameterDependencyGraph paramDepGrap = new ParameterDependencyGraph(); LinkedHashMap<String, Set<String>> dependencyGraph = new LinkedHashMap<>(); dependencyGraph.put( "param1", asSet( "param2", "param3" ) ); dependencyGraph.put( "param2", asSet( "param3", "param4" ) ); paramDepGrap.setDependencyGraph( dependencyGraph ); paramDepGrap.addDependency( "param3", "down1" ); assertEquals( paramDepGrap.getKnownParameter(), asSet( "param1", "param2", "param3" ) ); }