@Test
public void callgraphTest() {

  // Manually build a call graph: 10 nodes and 14 edges
  Graph<org.eclipse.steady.shared.json.model.ConstructId> graph = SlowSparseNumberedGraph.make();
  ConstructId a = JavaId.toSharedType(JavaId.parseMethodQName("test.a()"));
  graph.addNode(a);
  ConstructId b = JavaId.toSharedType(JavaId.parseMethodQName("test.b()"));
  graph.addNode(b);
  ConstructId c = JavaId.toSharedType(JavaId.parseMethodQName("test.c()"));
  graph.addNode(c);
  ConstructId d = JavaId.toSharedType(JavaId.parseMethodQName("test.d()"));
  graph.addNode(d);
  ConstructId e = JavaId.toSharedType(JavaId.parseMethodQName("test.e()"));
  graph.addNode(e);
  ConstructId f = JavaId.toSharedType(JavaId.parseMethodQName("test.f()"));
  graph.addNode(f);
  ConstructId g = JavaId.toSharedType(JavaId.parseMethodQName("test.g()"));
  graph.addNode(g);
  ConstructId h = JavaId.toSharedType(JavaId.parseMethodQName("test.h()"));
  graph.addNode(h);
  ConstructId i = JavaId.toSharedType(JavaId.parseMethodQName("test.i()"));
  graph.addNode(i);
  ConstructId j = JavaId.toSharedType(JavaId.parseMethodQName("test.j()"));
  graph.addNode(j);
  graph.addEdge(a, b);
  graph.addEdge(a, c);
  graph.addEdge(b, d);
  graph.addEdge(b, e);
  graph.addEdge(b, f);
  graph.addEdge(c, f);
  graph.addEdge(c, g);
  graph.addEdge(e, h);
  graph.addEdge(f, i);
  graph.addEdge(h, i);
  graph.addEdge(h, j);
  graph.addEdge(i, j);
  graph.addEdge(g, j);
  graph.addEdge(i, e);
  Callgraph cg = new Callgraph(graph);
  // source = a; target = j;
  // Test 1: compute the distance
  Map<ConstructId, Integer> distance = cg.getDist(j);
  int dist = distance.get(a);
  assertEquals(dist, 3);
  // Test 2: compute the shortest path
  Map<ConstructId, LinkedList<Integer>> shortestPaths = cg.getShortestPath(j, null);
  LinkedList<ConstructId> expectedShortestPath = new LinkedList<ConstructId>();
  expectedShortestPath.add(c);
  expectedShortestPath.add(g);
  expectedShortestPath.add(j);
  LinkedList<Integer> spath = shortestPaths.get(a);
  LinkedList<ConstructId> computedShortestPath = new LinkedList<ConstructId>();
  if (spath != null) {
    for (int n = (spath.size() - 1); n >= 0; n--) {
      computedShortestPath.add(cg.getConstructForId(spath.get(n)));
    }
  }
  assertEquals(computedShortestPath, expectedShortestPath);
  // Test 3: compute all paths: DepthFirstGetPaths
  AbstractGetPaths getpaths = new DepthFirstGetPaths(cg.getGraph(), cg.getNodeId());
  HashSet<LinkedList<ConstructId>> paths = getpaths.getAllPaths(a, j);
  for (LinkedList<ConstructId> p : paths) {
    for (ConstructId cid : p) System.out.print(cid.getQname() + "		");
    System.out.println();
  }
  assertEquals(paths.size(), 7);
  // Test 4: compute all paths: Get all paths from pruned graph
  getpaths = new PrunedGraphGetPaths(cg.getGraph(), cg.getNodeId());
  paths = getpaths.getAllPaths(a, j);
  for (LinkedList<ConstructId> p : paths) {
    for (ConstructId cid : p) System.out.print(cid.getQname() + "		");
    System.out.println();
  }
  assertEquals(paths.size(), 7);
}