@Test
public void testLazyPopulateSiblings() {

  myCaptureObject = new FakeCaptureObject.Builder().build();
  // create a mock class containing 209 instances
  List<InstanceObject> fakeInstances = new ArrayList<>();
  for (int i = 0; i < 209; i++) {
    String name = Integer.toString(i);
    fakeInstances.add(
      new FakeInstanceObject.Builder(myCaptureObject, MOCK_CLASS_ID, MOCK_CLASS_NAME).setName(name).setShallowSize(i).setDepth(i)
        .setRetainedSize(i).build());
  }
  myCaptureObject.addInstanceObjects(new HashSet<>(fakeInstances));
  myStage.selectCaptureDuration(
    new CaptureDurationData<>(1, false, false, new CaptureEntry<CaptureObject>(new Object(), () -> myCaptureObject)),
    null);
  myStage.selectHeapSet(myCaptureObject.getHeapSet(FakeCaptureObject.DEFAULT_HEAP_ID));
  myClassifierSetTree = myStageView.getClassifierView().getTree();
  assertThat(myClassifierSetTree).isNotNull();
  Object classifierRoot = myClassifierSetTree.getModel().getRoot();
  assertThat(classifierRoot).isInstanceOf(MemoryObjectTreeNode.class);
  assertThat(((MemoryObjectTreeNode)classifierRoot).getAdapter()).isInstanceOf(HeapSet.class);
  //noinspection unchecked
  myClassifierSetHeapNode = (MemoryObjectTreeNode<HeapSet>)classifierRoot;
  ClassifierSet classifierSet = myClassifierSetHeapNode.getAdapter().findContainingClassifierSet(fakeInstances.get(0));
  assertThat(classifierSet).isInstanceOf(ClassSet.class);
  myStage.selectClassSet((ClassSet)classifierSet);
  myClassSetTree = myClassSetView.getTree();
  assertThat(myClassSetTree).isNotNull();
  Object classSetRoot = myClassSetTree.getModel().getRoot();
  assertThat(classSetRoot).isInstanceOf(MemoryObjectTreeNode.class);
  assertThat(((MemoryObjectTreeNode)classSetRoot).getAdapter()).isInstanceOf(ClassSet.class);
  //noinspection unchecked
  myClassSetRootNode = (MemoryObjectTreeNode<MemoryObject>)classSetRoot;
  // View would display only the first 100 object, plus an extra node for sibling expansion.
  assertThat(myClassSetRootNode.getChildCount()).isEqualTo(101);
  // Selecting a regular node would do nothing
  myClassSetTree.addSelectionPath(new TreePath(new Object[]{myClassSetRootNode, myClassSetRootNode.getChildAt(0)}));
  assertThat(myClassSetRootNode.getChildCount()).isEqualTo(101);
  // Selecting the last node would expand the next 100
  myClassSetTree.addSelectionPath(new TreePath(new Object[]{myClassSetRootNode, myClassSetRootNode.getChildAt(100)}));
  assertThat(myClassSetRootNode.getChildCount()).isEqualTo(201);
  // Selecting the last node again would expand the remaining 9
  myClassSetTree.addSelectionPath(new TreePath(new Object[]{myClassSetRootNode, myClassSetRootNode.getChildAt(200)}));
  assertThat(myClassSetRootNode.getChildCount()).isEqualTo(209);
}