public static boolean isParentAncestorOf(
      Table table, long snapshotId, long ancestorParentSnapshotId) {
    for (Snapshot snapshot : ancestorsOf(snapshotId, table::snapshot)) {
      if (snapshot.parentId() != null && snapshot.parentId() == ancestorParentSnapshotId) {
        return true;
      }
    }

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