void () { assertEquals("a", ProgressIndicatorUtils.withTimeout(1_000_000_000, () -> "a")); assertNull(ProgressIndicatorUtils.withTimeout(1, () -> { TimeoutUtil.sleep(50); ProgressManager.checkCanceled(); return "a"; })); assertThrows(ProcessCanceledException.class, () -> ProgressIndicatorUtils.withTimeout(1, () -> { throw new ProcessCanceledException(); })); ProgressIndicatorBase outer = new ProgressIndicatorBase(); ProgressManager.getInstance().runProcess(() -> assertThrows(ProcessCanceledException.class, () -> ProgressIndicatorUtils.withTimeout(1, () -> { outer.cancel(); ProgressManager.checkCanceled(); return null; }) ), outer); }