void () { ConsoleViewImpl console = myConsole; console.print("Initial", ConsoleViewContentType.USER_INPUT); console.flushDeferredText(); console.clear(); console.print("Hi", ConsoleViewContentType.USER_INPUT); console.waitAllRequests(); UIUtil.dispatchAllInvocationEvents(); assertEquals(2, console.getContentSize()); assertEquals(2, console.getEditor().getCaretModel().getOffset()); console.getEditor().getCaretModel().setCaretsAndSelections(Collections.singletonList(new CaretState(new LogicalPosition(0,0), new LogicalPosition(0,0), new LogicalPosition(0,2)))); assertEquals(0, console.getEditor().getCaretModel().getOffset()); typeIn(console.getEditor(), 'x'); console.waitAllRequests(); UIUtil.dispatchAllInvocationEvents(); assertEquals(1, console.getContentSize()); }