void () { ProgressIndicator base = new EmptyProgressIndicator(); ProgressIndicator wrapper = new SensitiveProgressWrapper(base); wrapper.cancel(); assertTrue(wrapper.isCanceled()); assertFalse(base.isCanceled()); assertThrows(ProcessCanceledException.class, () -> ProgressManager.getInstance().executeProcessUnderProgress(() -> { assertTrue(wrapper.isCanceled()); ProgressManager.checkCanceled(); // this is the main check }, wrapper)); }