### Question:
FlowGraph { public Map<V, V> getImmediateDominators() { if(immediateDominators == null) { immediateDominators = new HashMap<>(); ensureDominatorsArrayIsCalculated(); for(int reversePostOrderIndex = 0; reversePostOrderIndex < dominators.length; reversePostOrderIndex++) { V vertex = reachableVertices.get(reversePostOrderIndex).value; if(reversePostOrderIndex == 0) { immediateDominators.put(vertex, null); } else { immediateDominators.put(vertex, reachableVertices.get(dominators[reversePostOrderIndex]).value); } } immediateDominators = Collections.unmodifiableMap(immediateDominators); } return immediateDominators; } FlowGraph(Map<V, Set<V>> edges, V entryPoint, V exitPoint); private  FlowGraph(FlowGraph<V> originalGraph); V getEntryPoint(); V getExitPoint(); Map<V, Set<V>> getSuccessors(); Map<V, Set<V>> getPredecessors(); Set<V> getVertices(); Set<V> getSuccessors(V vertex); Set<V> getPredecessors(V vertex); FlowGraph<V> getTransverseGraph(); Map<V, V> getImmediateDominators(); Map<V, Set<V>> getDominatorTree(); Map<V, Set<V>> getDominatorSets(); Map<V, Set<V>> getDominanceFrontiers(); Map<V, V> getImmediatePostDominators(); Map<V, Set<V>> getPostDominatorSets(); Map<V, Set<V>> getPostDominanceFrontiers(); Set<NaturalLoop<V>> getNaturalLoops(); boolean containsPath(V source, V target); @Override boolean equals(Object o); @Override int hashCode(); void write(Writer writer, String graphName, Comparator<V> vertexComparator,
                      Function<V, String> printer, int fontSize);  }### Answer:
@Test public void testGetImmediateDominatorsEmptyGraph() { Map<Integer, Integer> expected = new HashMap<>(); expected.put(0, null); expected.put(1, 0); assertEquals(expected, emptyGraph.getImmediateDominators()); }
@Test public void testGetImmediateDominatorsLoopingGraph() { Map<Integer, Integer> expected = new HashMap<>(); expected.put(0, null); expected.put(1, 0); expected.put(2, 1); expected.put(3, 1); expected.put(4, 3); expected.put(5, 4); expected.put(6, 4); expected.put(7, 4); expected.put(8, 7); expected.put(9, 8); expected.put(10, 8); expected.put(11, 10); assertEquals(expected, loopingGraph.getImmediateDominators()); }