@Test
	public void testCodeBrowser_CopyFromFunction_PasteToComment() throws Exception {
		//
		// Test that we can copy (simulating the keyboard action) from a function and then
		// paste onto a comment.
		//

		// 1)
		String functionName = "sscanf";
		FunctionNameFieldLocation location =
			new FunctionNameFieldLocation(program, addr("0100415a"), functionName);
		codeBrowserPlugin.goTo(location);

		ProgramLocation currentLocation = codeBrowserPlugin.getCurrentLocation();
		assertTrue(currentLocation instanceof FunctionNameFieldLocation);
		location = (FunctionNameFieldLocation) currentLocation;
		assertTrue(functionName.equals(location.getFunctionName()));

		assertTrue(codeBrowserClipboardProvider.canCopy());

		// 2)
		DockingAction copyAction = getAction(codeBrowserClipboardProvider, COPY_ACTION_NAME);
		ActionContext context = codeViewerProvider.getActionContext(null);
		performAction(copyAction, context, true);

		// 3)
		PlateFieldLocation plateFieldLocation =
			new PlateFieldLocation(program, addr("0100415a"), null, 1, 10, new String[] { "" }, 0);

		codeBrowserPlugin.goTo(plateFieldLocation);

		DockingAction pasteAction = getAction(codeBrowserClipboardProvider, PASTE_ACTION_NAME);
		context = codeViewerProvider.getActionContext(null);
		performAction(pasteAction, context, true);

		currentLocation = codeBrowserPlugin.getCurrentLocation();
		assertTrue(currentLocation instanceof PlateFieldLocation);
		plateFieldLocation = (PlateFieldLocation) currentLocation;
		String[] comments = plateFieldLocation.getComment();
		assertEquals(1, comments.length);
		assertEquals(functionName, comments[0]);
	}
Note: This test is sensitive to focus. So, don't click any windows while this test is running.
Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/clipboard/ClipboardPluginTest.java