@Test
	public void testMergeFragments() throws Exception {
		// select 2 fragments; note the address ranges, and cut.
		// select a destination fragment, choose paste.
		// verify that the cut fragments are removed from the program.
		// verify the address set of the destination fragment

		ProgramNode evNode = root.getChild("Everything");
		visitNode(evNode);
		ProgramNode fragNode = evNode.getChild("Fragments");
		expandPath(fragNode.getTreePath());
		ProgramNode[] cutNodes = new ProgramNode[2];
		AddressSet set = new AddressSet();
		for (int i = 0; i < cutNodes.length; i++) {
			cutNodes[i] = (ProgramNode) fragNode.getChildAt(i);
			set.add(cutNodes[i].getFragment());
			addSelectionPath(cutNodes[i].getTreePath());
		}

		performTreeAction(cutAction);

		// select a destination fragment
		ProgramNode stringsNode = root.getChild("Strings");
		visitNode(stringsNode);
		ProgramNode cNode = stringsNode.getChild("L");
		visitNode(cNode);
		ProgramNode fnode = cNode.getChild("testl");
		setSelectionPath(fnode);

		performTreeAction(pasteAction);

		for (ProgramNode cutNode : cutNodes) {
			assertNull(listing.getFragment("Main Tree", cutNode.getName()));
			assertEquals(0, findNodes(cutNode.getName()).length);
		}

		// note: >10 events causes the tree to get reloaded...
		root = (ProgramNode) tree.getModel().getRoot();
		stringsNode = root.getChild("Strings");
		cNode = stringsNode.getChild("L");
		fnode = cNode.getChild("testl");
		assertTrue(fnode.getFragment().contains(set));

		undo();
		expandNode(root);
		for (ProgramNode cutNode : cutNodes) {
			assertNotNull(listing.getFragment("Main Tree", cutNode.getName()));
			assertTrue(findNodes(cutNode.getName()).length > 0);
		}

		redo();
		expandNode(root);
		for (ProgramNode cutNode : cutNodes) {
			assertNull(listing.getFragment("Main Tree", cutNode.getName()));
			assertEquals(0, findNodes(cutNode.getName()).length);
		}
		stringsNode = root.getChild("Strings");
		cNode = stringsNode.getChild("L");
		fnode = cNode.getChild("testl");
		assertTrue(fnode.getFragment().contains(set));
	}
Tests for cut/copy/paste in the Program tree.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin2Test.java