void () { Application app = ApplicationManager.getApplication(); app.invokeAndWait(() -> { app.invokeLater(() -> { myOrder.add("1"); assertOrderedEquals(myOrder, "1"); UIUtil.dispatchAllInvocationEvents(); assertOrderedEquals(myOrder, "1", "2"); }); app.invokeLater(new MyRunnable("2")); UIUtil.dispatchAllInvocationEvents(); }); assertOrderedEquals(myOrder, "1", "2"); }