public static Iterable<Snapshot> ancestorsOf(long snapshotId, Function<Long, Snapshot> lookup) {
    Snapshot start = lookup.apply(snapshotId);
    Preconditions.checkArgument(start != null, "Cannot find snapshot: %s", snapshotId);
    return ancestorsOf(start, lookup);
  }
@Test
  public void ancestorsOf() {
    Iterable<Snapshot> snapshots = SnapshotUtil.ancestorsOf(snapshotFork2Id, table::snapshot);
    expectedSnapshots(new long[] {snapshotFork2Id, snapshotFork1Id}, snapshots);

    Iterator<Snapshot> snapshotIter = snapshots.iterator();
    while (snapshotIter.hasNext()) {
      snapshotIter.next();
    }

    // Once snapshot iterator has been exhausted, call hasNext again to make sure it is stable.
    assertThat(snapshotIter).isExhausted();
  }