void () { MyAbstractProgressIndicator progress = new MyAbstractProgressIndicator(); ProgressManager.getInstance().executeProcessUnderProgress(() -> { assertFalse(progress.isCanceled()); assertTrue(progress.isCancelable()); try { ProgressManager.getInstance().executeNonCancelableSection(()->{ assertFalse(progress.isCancelable()); progress.cancel(); assertTrue(progress.isCanceled()); progress.checkCanceled(); }); } catch (ProcessCanceledException e) { e.printStackTrace(); fail("must not throw"); } assertThrows(ProcessCanceledException.class, () -> progress.checkCanceled()); }, progress); }