@Test
public void testSyncFromNonUi() throws Exception {

  Future f = ApplicationManager.getApplication().executeOnPooledThread(() -> {
    StudioProgressRunner runner = new StudioProgressRunner(true, false, "test", null);
    AtomicBoolean invoked = new AtomicBoolean(false);
    ProgressRunner.ProgressRunnable runnable = (indicator, runner1) -> {
      assertFalse(ApplicationManager.getApplication().isDispatchThread());
      try {
        Thread.sleep(100);
      }
      catch (InterruptedException e) {
        fail();
      }
      invoked.set(true);
    };
    runner.runSyncWithProgress(runnable);
    assertTrue(invoked.get());
  });
  FutureUtils.pumpEventsAndWaitForFuture(f, 10, TimeUnit.SECONDS);
}