@Test
	public void testAskProgram_SCR8486() throws Exception {
		createScript();

		AtomicReference<Program> container = new AtomicReference<>();
		runSwing(() -> {
			try {
				Program p = script.askProgram("Test - Pick Program");
				container.set(p);
				if (p != null) {
					p.release(this);
				}
			}
			catch (Exception ioe) {
				failWithException("Caught unexepected during askProgram()", ioe);
			}
		}, false);

		DataTreeDialog dtd = waitForDialogComponent(DataTreeDialog.class);
		JButton okButton = (JButton) getInstanceField("okButton", dtd);
		runSwing(() -> okButton.doClick());

		// this test will fail if we encountered an exception
		assertNull(container.get());

		runSwing(() -> dtd.close());
	}
A large timeout period that is usually not reached
Ghidra/Features/Base/src/test.slow/java/ghidra/app/script/GhidraScriptAskMethodsTest.java