void () { if (SwingUtilities.isEventDispatchThread()) { UIUtil.dispatchAllInvocationEvents(); } else { UIUtil.pump(); } //some weird things like MyFireIdleRequest may still sneak in //assertEquals(null, Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent()); }