private void cleanupAutoAnalysisManagers(PluginTool t) {

		@SuppressWarnings("unchecked")
		Map<Program, AutoAnalysisManager> map = (Map<Program, AutoAnalysisManager>) TestUtils
				.getInstanceField("managerMap", AutoAnalysisManager.class);
		Collection<AutoAnalysisManager> managers = map.values();
		for (AutoAnalysisManager manager : managers) {
			@SuppressWarnings("unchecked")
			Map<Program, WeakSet<PluginTool>> toolMap =
				(Map<Program, WeakSet<PluginTool>>) TestUtils.getInstanceField("toolMap", manager);

			Collection<WeakSet<PluginTool>> values = toolMap.values();
			for (WeakSet<PluginTool> toolSet : values) {
				for (PluginTool aaTool : toolSet) {
					manager.removeTool(aaTool);
				}
			}
		}
	}
Special code to make sure that the tool used by an AutoAnalysis manager instance is
removed.  This prevents the accidental re-use of the wrong tool between test runs.
(Why?  Well, the AA manager has a static map of tools and it sometimes picks tools to
use based upon which GUI window is active, which when the current window is not active,
can cause the wrong tool to be used for a test, which means that a disposed tool can
be used, which prevents AA from running).
<p>
This code is our use of inside knowledge to cleanup testing artifacts.
<p>
Note: if each test fired a 'program closed' event, then this wouldn't be an issue, but
they don't.  Further, doing that here has ramifications with threading and timely
closing of the test environment.  So, rather than fire an event here, we will just
do our magic.
Ghidra/Features/Base/src/main/java/ghidra/test/TestEnv.java