private void programLocationChange(String buttonText) throws Exception {
		// create Plate, pre, end of line, post and repeatable comments
		// that contain a hit for a search

		CodeUnit cu = listing.getCodeUnitAt(getAddr(0x0100416f));
		int transactionID = program.startTransaction("test");
		cu.setComment(CommentType.EOL, "call sscanf");

		cu = listing.getCodeUnitAt(getAddr(0x01004178));
		cu.setComment(CommentType.REPEATABLE, "make a reference to sscanf");

		cu = listing.getCodeUnitAt(getAddr(0x01004192));
		cu.setComment(CommentType.PLATE, "another ref to sscanf");
		cu.setComment(CommentType.POST, "sscanf in a post comment");

		cu = listing.getCodeUnitAt(getAddr(0x0100467b));
		cu.setComment(CommentType.PRE, "call sscanf here");

		program.endTransaction(transactionID, true);

		SearchTextDialog dialog = getDialog();
		JTextField tf = findTextField(dialog.getComponent());
		selectRadioButton(dialog.getComponent(), buttonText);

		goToService.goTo(new ProgramLocation(program, getAddr(0x01004160)));

		setText(tf, "sscanf");
		searchOnce(tf);
		waitForSearchTasks(dialog);

		ProgramLocation loc = cbPlugin.getCurrentLocation();
		assertEquals(getAddr(0x0100416f), loc.getAddress());
		assertTrue(loc instanceof CommentFieldLocation);
		assertEquals(CommentType.EOL, ((CommentFieldLocation) loc).getCommentType());

		JButton searchButton = (JButton) findButton(dialog.getComponent(), "Next");
		pressButton(searchButton);
		waitForSearchTasks(dialog);

		loc = cbPlugin.getCurrentLocation();
		assertEquals(getAddr(0x01004178), loc.getAddress());
		assertTrue(loc instanceof CommentFieldLocation);
		assertEquals(CommentType.REPEATABLE, ((CommentFieldLocation) loc).getCommentType());

		pressButton(searchButton);
		waitForSearchTasks(dialog);

		loc = cbPlugin.getCurrentLocation();
		assertEquals(getAddr(0x01004192), loc.getAddress());
		assertTrue(loc instanceof CommentFieldLocation);
		assertEquals("Search result not placed at the matching character position", 15,
			loc.getCharOffset());
		assertEquals(CommentType.PLATE, ((CommentFieldLocation) loc).getCommentType());

		pressButton(searchButton);
		waitForSearchTasks(dialog);

		loc = cbPlugin.getCurrentLocation();
		assertEquals(getAddr(0x01004192), loc.getAddress());
		assertTrue(loc instanceof CommentFieldLocation);
		assertEquals(CommentType.POST, ((CommentFieldLocation) loc).getCommentType());

		pressButton(searchButton);
		waitForSearchTasks(dialog);

		goToService.goTo(new ProgramLocation(program, getAddr(0x01004100)));

		pressButton(searchButton);
		waitForSearchTasks(dialog);

		loc = cbPlugin.getCurrentLocation();
		assertEquals(getAddr(0x0100415a), loc.getAddress());
		assertTrue(loc instanceof CommentFieldLocation);
		assertEquals(CommentType.PRE, ((CommentFieldLocation) loc).getCommentType());
	}
Tests for the search text plugin.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java