StudioProgressRunner implements ProgressRunner { @Override public void runAsyncWithProgress(@NotNull final ProgressRunnable r) { runAsyncWithProgress(r, false); } StudioProgressRunner(boolean modal,
                              boolean cancellable,
                              String progressTitle,
                              @Nullable Project project); @Override void runAsyncWithProgress(@NotNull final ProgressRunnable r); @VisibleForTesting void runAsyncWithProgress(@NotNull final ProgressRunnable r, boolean overrideTestMode); @Override void runSyncWithProgress(@NotNull final ProgressRunnable progressRunnable); @Override void runSyncWithoutProgress(@NotNull Runnable r);  }
@Test public void testAsyncWithProgressNonUi() throws Exception { StudioProgressRunner runner = new StudioProgressRunner(false, false, "test", null); Semaphore lock = new Semaphore(1); lock.acquire(); ProgressRunner.ProgressRunnable runnable = (indicator, runner1) -> { assertFalse(ApplicationManager.getApplication().isDispatchThread()); try { lock.acquire(); } catch (InterruptedException e) { fail(); } }; runner.runAsyncWithProgress(runnable, true); lock.release(); }