private static <T> T waitForValue(Supplier<T> supplier, String failureMessage,
			boolean failOnTimeout) {
		int totalTime = 0;
		while (totalTime <= DEFAULT_WAIT_TIMEOUT) {

			T t = supplier.get();
			if (t != null) {
				return t; // success
			}

			totalTime += sleep(DEFAULT_WAIT_DELAY);
		}

		if (!failOnTimeout) {
			return null;
		}

		String error =
			failureMessage != null ? failureMessage : "Timed-out waiting for non-null value";
		throw new AssertionFailedError(error);
	}
Waits for the value returned by the supplier to be non-null, optionally throwing an exception
if that does not happen by the given timeout.

@param supplier the supplier of the value
@param failureMessage the message to print upon the timeout being reached
@param failOnTimeout if true, an exception will be thrown if the timeout is reached
@return the value
@throws AssertionFailedError if a non-null value is not returned within the timeout period
Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGTest.java