@Test
	public void testStateOnSwitch() throws Exception {
		tool.addPlugin(CodeBrowserPlugin.class.getName());
		setFrameSize(400, 500);

		Program p1 = openDummyProgram("notepad", true);
		Program p2 = openDummyProgram("login", true);

		ProgramManager programManager = tool.getService(ProgramManager.class);
		programManager.setCurrentProgram(p1);

		MarkerSet set = createMarkers(p1);
		CodeBrowserPlugin cb = env.getPlugin(CodeBrowserPlugin.class);
		FieldPanel fp = cb.getFieldPanel();
		Address address = cb.getListingPanel().getAddressIndexMap().getAddress(BigInteger.ZERO);
		runSwing(() -> {
			set.add(address);
			fp.setCursorPosition(BigInteger.valueOf(4), 0, 0, 0);
		});

		assertEquals(BigInteger.valueOf(4), fp.getCursorLocation().getIndex());

		programManager.setCurrentProgram(p2);
		assertEquals(BigInteger.ZERO, fp.getCursorLocation().getIndex());

		programManager.setCurrentProgram(p1);
		assertEquals(BigInteger.valueOf(4), fp.getCursorLocation().getIndex());
	}
Tests for the plugin that manages the tab for multiple open programs.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/progmgr/MultiTabPluginTest.java