@Test
	public void testPasteNonContiguousSelection() throws Exception {
		// in Browser(1) add a pre comment at 331
		CodeUnit cu = programOne.getListing().getCodeUnitAt(addr(programOne, 0x331));
		int transactionID = programOne.startTransaction("test");
		cu.setComment(CommentType.PRE, "my pre comment for this test");
		programOne.endTransaction(transactionID, true);
		waitForSwing();

		// in Browser(2) select 031b and 0331
		goTo(toolTwo, 0x031b);

		AddressSet set = new AddressSet();
		set.addRange(addr(programTwo, 0x31b), addr(programTwo, 0x31d));
		set.addRange(addr(programTwo, 0x331), addr(programTwo, 0x333));

		makeSelection(toolTwo, programTwo, set);

		copyToolTwoLabels();

		// in Browser(1) go to 31b
		goTo(toolOne, 0x31b);

		pasteToolOne();

		// verify the labels are copied
		assertNull(
			programOne.getSymbolTable().getSymbol("LAB_0331", addr(programOne, 0x0331), null));
		Symbol symbol = getUniqueSymbol(programOne, "RSTOR()", null);
		assertNotNull(symbol);
		assertEquals(addr(programOne, 0x31b), symbol.getAddress());
		assertNull(
			programOne.getSymbolTable().getSymbol("LAB_0331", addr(programOne, 0x0331), null));
		symbol = getUniqueSymbol(programOne, "RSR10", null);
		assertNotNull(symbol);
		assertEquals(addr(programOne, 0x331), symbol.getAddress());

		// verify pre comment at 331 remains unaffected
		cu = programOne.getListing().getCodeUnitAt(addr(programOne, 0x331));
		assertEquals("my pre comment for this test", cu.getComment(CommentType.PRE));

		// verify browser field

		cb.goToField(addr(programOne, 0x0331), LabelFieldFactory.FIELD_NAME, 0, 0);
		ListingTextField f = (ListingTextField) cb.getCurrentField();
		assertEquals("RSR10", f.getText());

		cb.goToField(addr(programOne, 0x031b), LabelFieldFactory.FIELD_NAME, 0, 0);
		f = (ListingTextField) cb.getCurrentField();
		assertEquals("RSTOR()", f.getText());

		cb.goToField(addr(programOne, 0x0331), "Pre-Comment", 0, 0);
		f = (ListingTextField) cb.getCurrentField();
		assertEquals("my pre comment for this test", f.getText());

		undo(programOne);

		cb.goToField(addr(programOne, 0x0331), LabelFieldFactory.FIELD_NAME, 0, 0);
		f = (ListingTextField) cb.getCurrentField();
		assertEquals(programOne.getSymbolTable()
				.getSymbol("LAB_00000331", addr(programOne, 0x0331), null)
				.getName(),
			f.getText());

		cb.goToField(addr(programOne, 0x031b), LabelFieldFactory.FIELD_NAME, 0, 0);
		f = (ListingTextField) cb.getCurrentField();
		assertEquals(programOne.getSymbolTable()
				.getSymbol("LAB_0000031b", addr(programOne, 0x031b), null)
				.getName(),
			f.getText());

		redo(programOne);

		cb.goToField(addr(programOne, 0x0331), LabelFieldFactory.FIELD_NAME, 0, 0);
		f = (ListingTextField) cb.getCurrentField();
		assertEquals("RSR10", f.getText());

		cb.goToField(addr(programOne, 0x031b), LabelFieldFactory.FIELD_NAME, 0, 0);
		f = (ListingTextField) cb.getCurrentField();
		assertEquals("RSTOR()", f.getText());
	}
Test the plugin that deals with cut/paste comments and labels
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/clipboard/CopyPasteCommentsTest.java