@Test
  public void storeParentChildDescendantProjectsAndRetrieveAncestry() throws Exception {
    final ProjectVersionRef r = new SimpleProjectVersionRef("org.test", "root", "1");
    final ProjectVersionRef p = new SimpleProjectVersionRef("org.test", "parent", "1.0");
    final ProjectVersionRef c = new SimpleProjectVersionRef("org.test", "child", "1.0");

    final EProjectDirectRelationships root =
        new EProjectDirectRelationships.Builder(sourceUri, r).build();
    final EProjectDirectRelationships parent =
        new EProjectDirectRelationships.Builder(sourceUri, p).withParent(r).build();
    final EProjectDirectRelationships child =
        new EProjectDirectRelationships.Builder(sourceUri, c).withParent(p).build();

    graph.storeRelationships(root.getExactAllRelationships());
    graph.storeRelationships(parent.getExactAllRelationships());
    graph.storeRelationships(child.getExactAllRelationships());

    final List<ProjectVersionRef> ancestry = CartoGraphUtils.getAncestry(c, graph);
    assertThat(ancestry, notNullValue());
    assertThat(ancestry.size(), equalTo(3));

    final Iterator<ProjectVersionRef> iterator = ancestry.iterator();
    assertThat(iterator.next(), equalTo(c));
    assertThat(iterator.next(), equalTo(p));
    assertThat(iterator.next(), equalTo(r));
  }