void () { final int count = 10; new BombedProgressIndicator(count).runBombed(() -> { for (int i = 0; i < count * 2; i++) { TimeoutUtil.sleep(10); try { ProgressManager.checkCanceled(); if (i >= count) { assertThrows(ProcessCanceledException.class, () -> ProgressManager.checkCanceled()); } } catch (ProcessCanceledException e) { if (i < count) { fail("Too early PCE"); } } } }); }