@Test
public void ancestorsAreReturnedInOrder() throws Exception {

  JPanel panel1 = new JPanel();
  JPanel panel2 = new JPanel();
  JPanel panel3 = new JPanel();
  panel1.add(panel2);
  panel2.add(panel3);
  TreeWalker treeWalker = new TreeWalker(panel3);
  assertThat(treeWalker.ancestorStream().collect(Collectors.toList())).containsExactly(panel3, panel2, panel1).inOrder();
}