void () { ApplicationManager.getApplication().invokeAndWait(() -> ProgressManager.getInstance().run(new Task.Modal(getProject(), "", false) { @Override public void run(@NotNull ProgressIndicator indicator) { ModalityState state = indicator.getModalityState(); assertSame(state, ModalityState.defaultModalityState()); ApplicationManager.getApplication().invokeAndWait(() -> assertSame(state, ModalityState.defaultModalityState()), state); } })); }