void () { int N = 1_000_000; AtomicInteger counter = new AtomicInteger(); Runnable r = () -> counter.incrementAndGet(); Application application = ApplicationManager.getApplication(); application.invokeAndWait(r); PlatformTestUtil.startPerformanceTest(getTestName(false), 900, () -> { counter.set(0); UIUtil.invokeAndWaitIfNeeded(() -> LaterInvocator.enterModal(myWindow1)); for (int i = 0; i < N; i++) { application.invokeLater(r); } assertEquals(0, counter.get()); UIUtil.invokeAndWaitIfNeeded(() -> LaterInvocator.leaveModal(myWindow1)); application.invokeAndWait(EmptyRunnable.getInstance()); assertEquals(N, counter.get()); }).assertTiming(); }