void () { @SuppressWarnings("UndesirableClassUsage") JTree tree = new JTree(new DefaultTreeModel( node("/", node("ktor", node("ktor-core"), node("ktor-features", node("jetty-http-client"), node("ktor-locations", node("src", node("asdsd.asdas.asdas", node("a"), node("b"), node("c"))), node("tests", node("fooo")), node("zar.txt"), node("zoo.txt"))))))); TreeTestUtil.assertTreeUI(tree); expandAll(tree); waitForTestOnEDT(() -> { tree.setSelectionRow(10); Assert.assertEquals(15, tree.getRowCount()); assertTree(tree, """ -/ -ktor ktor-core -ktor-features jetty-http-client -ktor-locations -src -asdsd.asdas.asdas a b [c] -tests fooo zar.txt zoo.txt """); TreeSmartSelectProvider provider = new TreeSmartSelectProvider(); provider.increaseSelection(tree); provider.increaseSelection(tree); provider.increaseSelection(tree); provider.increaseSelection(tree); provider.increaseSelection(tree); assertTree(tree, """ -/ -ktor ktor-core -ktor-features jetty-http-client -[ktor-locations] -[src] -[asdsd.asdas.asdas] [a] [b] [c] -[tests] [fooo] [zar.txt] [zoo.txt] """); }); }