@Test
	public void testSaveRestoreFavorites() throws Exception {
		env.showTool();

		tree.expandPath(builtInNode);
		waitForTree();
		DataTypeNode node = (DataTypeNode) builtInNode.getChild("PascalUnicode");
		DataTypeNode node2 = (DataTypeNode) builtInNode.getChild("undefined1");
		DataTypeNode node3 = (DataTypeNode) builtInNode.getChild("undefined2");
		DataTypeNode node4 = (DataTypeNode) builtInNode.getChild("undefined4");

		tree.setSelectionPaths(new TreePath[] { node.getTreePath(), node2.getTreePath(),
			node3.getTreePath(), node4.getTreePath() });
		waitForTree();

		assertTrue(favoritesAction.isEnabledForContext(createContext(node4)));

		performToggleAction(favoritesAction, true);

		List<DataType> dts = plugin.getFavorites();

		env.saveRestoreToolState();

		plugin = getPlugin(tool, DataTypeManagerPlugin.class);
		List<DataType> newdts = plugin.getFavorites();
		assertEquals(dts.size(), newdts.size());
		for (int i = 0; i < dts.size(); i++) {
			assertTrue(dts.get(i).isEquivalent(newdts.get(i)));
		}
	}
Test the favorites and data manager services.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/FavoritesAndMiscTest.java