void (@NotNull ProgressIndicator indicator) { myFlag = false; JobScheduler.getScheduler().schedule(() -> myFlag = true, 100, TimeUnit.MILLISECONDS); TestTimeOut t = TestTimeOut.setTimeout(10, TimeUnit.SECONDS); assertThrows(ProcessCanceledException.class, () -> ProgressManager.getInstance().executeProcessUnderProgress(() -> { while (!t.timedOut()) { ProgressManager.checkCanceled(); } }, indicator)); assertTrue(checkCanceledCalled); }