### Question:
ExecutionGrapher { public static String graph(ExecutionGraph graph) { ExecutionNode node = graph.getRoot(); StringBuilder sb = new StringBuilder("digraph {\n"); getGraph(node, graph, sb, new ArrayList<>()); sb.append("labelloc=\"t\"\n"); sb.append("label=\"").append(graph.getMethod()).append("\";\n"); sb.append('}'); return sb.toString(); }  static String graph(ExecutionGraph graph);  }### Answer:
@Test public void testHasExpectedGraph() { ExecutionNode child = buildNode(CHILD_ADDRESS, CHILD_NODE_STR, CHILD_STATE_STR); when(child.getChildren()).thenReturn(new LinkedList<ExecutionNode>()); ExecutionNode root = buildNode(ROOT_ADDRESS, ROOT_NODE_STR, ROOT_STATE_STR); List<ExecutionNode> children = new LinkedList<ExecutionNode>(); children.add(child); when(root.getChildren()).thenReturn(children); VirtualMethod localMethod = mock(VirtualMethod.class); when(localMethod.toString()).thenReturn(METHOD_SIGNATURE); ExecutionGraph graph = mock(ExecutionGraph.class); when(graph.getRoot()).thenReturn(root); when(graph.getMethod()).thenReturn(localMethod); when(graph.getNodeIndex(root)).thenReturn(0); when(graph.getNodeIndex(child)).thenReturn(0); String digraph = ExecutionGrapher.graph(graph); StringBuilder sb = new StringBuilder("digraph {\n"); sb.append("\"@").append(ROOT_ADDRESS).append(".0 :: ").append(ROOT_NODE_STR).append('\n'); sb.append(ROOT_STATE_STR).append("\" -> "); sb.append("\"@").append(CHILD_ADDRESS).append(".0 :: ").append(CHILD_NODE_STR).append('\n'); sb.append(CHILD_STATE_STR).append("\"\n"); sb.append("labelloc=\"t\"\n"); sb.append("label=\"").append(METHOD_SIGNATURE).append("\";"); sb.append("\n}"); String expected = sb.toString(); assertEquals(expected, digraph); }