void () { ConsoleViewImpl console = myConsole; Alarm alarm = new Alarm(getTestRootDisposable()); for (int i=0; i<1000/*000*/; i++) { CountDownLatch latch = new CountDownLatch(1); alarm.addRequest(() -> { console.clear(); console.print("Test", ConsoleViewContentType.NORMAL_OUTPUT); console.scrollTo(0); latch.countDown(); }, 0); while (latch.getCount() != 0) { UIUtil.dispatchAllInvocationEvents(); } while (console.hasDeferredOutput()) { UIUtil.dispatchAllInvocationEvents(); } assertEquals("Test", console.getText()); } }