### Question:
DAG { public boolean addEdge(Node fromNode, Node toNode) { return addEdge(fromNode, toNode, false); } DAG(); void addNode(Node node, NodeInfo nodeInfo); boolean addEdge(Node fromNode, Node toNode); boolean addEdge(Node fromNode, Node toNode, EdgeInfo edge, boolean createNode); boolean containsNode(Node node); boolean containsEdge(Node fromNode, Node toNode); NodeInfo getNode(Node node); int getNodesCount(); int getEdgesCount(); Collection<Node> getBeginNode(); Collection<Node> getEndNode(); Set<Node> getPreviousNodes(Node node); Set<Node> getSubsequentNodes(Node node); int getIndegree(Node node); boolean hasCycle(); List<Node> topologicalSort();  }### Answer:
@Test public void testAddEdge() { clear(); assertFalse(graph.addEdge(1, 2, "edge(1 -> 2)", false)); graph.addNode(1, "v(1)"); assertTrue(graph.addEdge(1, 2, "edge(1 -> 2)",true)); graph.addNode(2, "v(2)"); assertTrue(graph.addEdge(1, 2, "edge(1 -> 2)",true)); assertFalse(graph.containsEdge(1, 3)); assertTrue(graph.containsEdge(1, 2)); assertEquals(graph.getEdgesCount(), 1); int node = 3; graph.addNode(node, "v(3)"); assertFalse(graph.addEdge(node, node)); }