ParameterDependencyGraph { public Set<String> getDependentParameterFor( String parameterName ) { if ( !allParametersProcessed ) { return Collections.emptySet(); } final Set<String> strings = dependencyGraph.getOrDefault( parameterName, Collections.emptySet() ); return Collections.unmodifiableSet( strings ); } 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 testGetDependentParameterFor() { ParameterDependencyGraph paramDepGrap = new ParameterDependencyGraph( "param1", "param2" ); assertEquals( paramDepGrap.getDependentParameterFor( "param1" ), asSet() ); paramDepGrap.setAllParametersProcessed( true ); LinkedHashMap<String, Set<String>> dependencyGraph = new LinkedHashMap<>(); dependencyGraph.put( "param1", asSet( "param2", "param3" ) ); paramDepGrap.setDependencyGraph( dependencyGraph ); assertEquals( paramDepGrap.getDependentParameterFor( "param1" ), asSet( "param2", "param3" ) ); paramDepGrap.setAllParametersProcessed( false ); assertEquals( paramDepGrap.getDependentParameterFor( "param2" ), Collections.emptySet() ); }