@Test
	public void testRestoreTreeState() {
		//
		// Test that we can setup the tree, record its state, change the tree and then restore
		// the saved state
		//
		TreePath selectionPath = gTree.getSelectionPath();
		assertNull("Unexpectedly have a selected path by default", selectionPath);

		GTreeNode originalNode = findNodeInTree("Leaf Child - Many B1");
		assertNotNull("Did not find existing child node in non filtered tree", originalNode);

		gTree.setSelectedNode(originalNode);
		waitForTree();

		selectionPath = gTree.getSelectionPath();
		assertNotNull("Tree did not select node", selectionPath);
		assertEquals(originalNode, selectionPath.getLastPathComponent());

		GTreeState treeState = gTree.getTreeState();

		gTree.clearSelectionPaths();
		waitForTree();

		selectionPath = gTree.getSelectionPath();
		assertNull("Selection paths not cleared", selectionPath);

		GTreeNode anotherNode =
			findNodeInTree(NonLeafWithOneLevelOfChildrenNodeA.class.getSimpleName());
		assertNotNull("Could not find expected node", anotherNode);

		gTree.setSelectedNode(anotherNode);
		waitForTree();

		selectionPath = gTree.getSelectionPath();
		assertNotNull("Tree did not select node", selectionPath);
		assertEquals(anotherNode, selectionPath.getLastPathComponent());

		gTree.restoreTreeState(treeState);
		waitForTree();

		selectionPath = gTree.getSelectionPath();
		assertNotNull("Tree did not select node", selectionPath);
		assertEquals(originalNode, selectionPath.getLastPathComponent());
	}
Test variable to easily control the filtering of test filters.
Ghidra/Framework/Docking/src/test.slow/java/docking/widgets/tree/GTreeTest.java