void () { Semaphore mayStop = new Semaphore(1); ProgressIndicatorBase progress = new ProgressIndicatorBase(); Future<?> task = startBackgroundProcess(progress, () -> ProgressSuspender.markSuspendable(progress, ""), () -> workUntilStopped(mayStop, progress)); suspendProgressAndRun(progress, () -> { mayStop.up(); letBackgroundThreadsSuspend(); assertFalse(task.isDone()); }); assertThreadCompleted(task); }