public static boolean isAncestorOf(Table table, long snapshotId, long ancestorSnapshotId) {
    for (Snapshot snapshot : ancestorsOf(snapshotId, table::snapshot)) {
      if (snapshot.snapshotId() == ancestorSnapshotId) {
        return true;
      }
    }

    return false;
  }
@Test
  public void isAncestorOf() {
    assertThat(SnapshotUtil.isAncestorOf(table, snapshotMain1Id, snapshotBaseId)).isTrue();
    assertThat(SnapshotUtil.isAncestorOf(table, snapshotBranchId, snapshotMain1Id)).isFalse();
    assertThat(SnapshotUtil.isAncestorOf(table, snapshotFork2Id, snapshotFork0Id)).isFalse();

    assertThat(SnapshotUtil.isAncestorOf(table, snapshotMain1Id)).isTrue();
    assertThat(SnapshotUtil.isAncestorOf(table, snapshotBranchId)).isFalse();
  }