private void verifyProgramStateThenUndo(boolean functionShouldExist) {

		waitForBusyTool(tool);

		// verify that function does not get created when resumed
		cb.goToField(addr("0x1001100"), "Operands", 0, 0);
		Function f = program.getListing().getFunctionAt(addr("0x100110a"));
		if (functionShouldExist) {
			assertNotNull("Function should have been analyzed", f);
		}
		else {
			assertNull("Function should not have been analyzed", f);
		}

		Options list = program.getOptions("TEST");
		assertTrue("Lower priorty analysis task failed to complete after worker",
			list.getBoolean("p1", false));

		try {
			program.undo();
		}
		catch (IOException e) {
			Assert.fail("Unexpected exception");
		}
	}
Test attempt to run an AnalysisWorker from swing thread
@throws Exception
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/AutoAnalysisWorkerTest.java