### Question:
DAG { public void addNode(Node node, NodeInfo nodeInfo) { lock.writeLock().lock(); try{ nodesMap.put(node, nodeInfo); }finally { lock.writeLock().unlock(); } } 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 testAddNode() { clear(); graph.addNode(1, "v(1)"); graph.addNode(2, null); graph.addNode(5, "v(5)"); assertEquals(graph.getNodesCount(), 3); assertEquals(graph.getNode(1), "v(1)"); assertTrue(graph.containsNode(1)); assertFalse(graph.containsNode(10)); }