void () { ProgressIndicator progress = new DaemonProgressIndicator(); UsefulTestCase.assertThrows(ProcessCanceledException.class, () -> JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Collections.nCopies(100_000, null), progress, __ -> { if (COUNT.incrementAndGet() == 10_000) { progress.cancel(); } return true; })); assertTrue(progress.isCanceled()); }