void () { assertClear(); myCm.toggleSelection(myFs.getNode(myFs.myInner11)); myCm.toggleSelection(myFs.getNode(myFs.myInner12)); Runnable afterTwoMiddle = () -> { assertNodeState(myFs.myParent, TreeNodeState.HAVE_SELECTED_BELOW, false); assertNodeState(myFs.myMiddle2, TreeNodeState.CLEAR, true); assertNodeState(myFs.myMiddle1, TreeNodeState.HAVE_SELECTED_BELOW, false); assertNodeState(myFs.myInner12, TreeNodeState.SELECTED, true); assertNodeState(myFs.myInner11, TreeNodeState.SELECTED, false); assertNodeState(myFs.myLeaf1, TreeNodeState.HAVE_SELECTED_ABOVE, false); assertNodeState(myFs.myLeaf2, TreeNodeState.HAVE_SELECTED_ABOVE, false); }; afterTwoMiddle.run(); // try third myCm.toggleSelection(myFs.getNode(myFs.myInner21)); // get same afterTwoMiddle.run(); // take parent myCm.toggleSelection(myFs.getNode(myFs.myMiddle1)); afterMiddle1(); // clear myCm.toggleSelection(myFs.getNode(myFs.myMiddle1)); assertClear(); }