void (int selectionMode, boolean rootVisible, Consumer<? super JTree> consumer) { @SuppressWarnings("UndesirableClassUsage") JTree tree = new JTree(new DefaultTreeModel(root())); TreeTestUtil.assertTreeUI(tree); tree.getSelectionModel().setSelectionMode(selectionMode); tree.setRootVisible(rootVisible); expandAll(tree); waitForTestOnEDT(() -> { tree.collapseRow(normalize(tree, 5)); tree.clearSelection(); assertTree(tree, """ -Root -Color Red Green Blue +Digit -Letter -Greek Alpha Beta Gamma Delta Epsilon """); consumer.accept(tree); }); }