### Question:
VirtualArray extends VirtualType { @Override public Set<? extends VirtualType> getAncestors() { if (ancestors != null) { return ancestors; } ancestors = new LinkedHashSet<>(); getAncestors0(this, ancestors); ancestors.remove(this); return ancestors; } VirtualArray(TypeReference typeReference); @Override Set<? extends VirtualType> getImmediateAncestors(); @Override Set<? extends VirtualType> getAncestors(); @Override VirtualField getField(String fieldName); @Override Collection<VirtualField> getFields(); @Override VirtualMethod getMethod(String methodDescriptor); @Override Collection<VirtualMethod> getMethods(); @Override boolean instanceOf(VirtualType targetType); @Override boolean isArray(); @Override boolean isPrimitive(); VirtualType getBaseType(); VirtualType getComponentType();  }### Answer:
@Test public void threeDimensionalStringArrayHasExpectedAncestors() { String arrayType = "[[[" + CommonTypes.STRING; virtualArray = (VirtualArray) classManager.getVirtualType(arrayType); String[] expectedAncestorNames = new String[]{ "[[[Ljava/lang/Object;", "[[[Ljava/lang/CharSequence;", "[[[Ljava/lang/Comparable;", "[[[Ljava/io/Serializable;", "[[Ljava/lang/Object;", "[Ljava/lang/Object;", "Ljava/lang/Object;" }; Set<VirtualType> expectedAncestors = Arrays.stream(expectedAncestorNames).map(a -> classManager.getVirtualType(a)).collect(Collectors.toSet()); Set<? extends VirtualType> ancestors = virtualArray.getAncestors(); assertEquals(expectedAncestors, ancestors); }
@Test public void threeDimensionalIntArrayHasExpectedAncestors() { String arrayType = "[[[" + CommonTypes.INTEGER; virtualArray = (VirtualArray) classManager.getVirtualType(arrayType); String[] expectedAncestorNames = new String[]{ "[[Ljava/lang/Object;", "[Ljava/lang/Object;", "Ljava/lang/Object;" }; Set<VirtualType> expectedAncestors = Arrays.stream(expectedAncestorNames).map(a -> classManager.getVirtualType(a)).collect(Collectors.toSet()); Set<? extends VirtualType> ancestors = virtualArray.getAncestors(); assertEquals(expectedAncestors, ancestors); }