CubeId { public boolean isAncestorOf(@NonNull CubeId input) { if (!haveSameDimensions(this, input) || getLevel() >= input.getLevel()) { return false; } for (int i = getLevel() - 1; i >= 0; i--) { if (!input.getDimensionValue(i).equals(getDimensionValue(i))) { return false; } } return true; } private  CubeId(@NonNull String[] dimensionIds, @NonNull String[] dimensionsValues); @NonNull static CubeId root(@NonNull String... dimensionIds); @NonNull static CubeId root(@NonNull List<String> dimensionIds); @NonNegative int getLevel(); @NonNegative int getMaxLevel(); @NonNull String getDimensionValue(@NonNegative int index); @NonNull Stream<String> getDimensionValueStream(); @NonNull String getDimensionId(@NonNegative int index); @NonNegative int getDepth(); boolean isRoot(); boolean isSeries(); boolean isVoid(); @NonNull CubeId child(@NonNull String... dimensionValues); boolean isAncestorOf(@NonNull CubeId input); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test @SuppressWarnings("null") public void testIsAncestorOf() { assertThatThrownBy(() -> EMPTY.isAncestorOf(null)).isInstanceOf(NullPointerException.class); assertThat(EMPTY.isAncestorOf(EMPTY)).isFalse(); assertThat(SECTOR_REGION.isAncestorOf(SECTOR_REGION)).isFalse(); assertThat(SECTOR_REGION.isAncestorOf(INDUSTRY)).isTrue(); assertThat(INDUSTRY.isAncestorOf(SECTOR_REGION)).isFalse(); }