void () { ApplicationManager.getApplication().invokeAndWait(() -> { AtomicBoolean invoked = new AtomicBoolean(); LaterInvocator.markTransparent(ModalityState.stateForComponent(myModalDialog)); ApplicationManager.getApplication().invokeLater(() -> invoked.set(true), ModalityState.nonModal()); LaterInvocator.enterModal(myModalDialog); UIUtil.dispatchAllInvocationEvents(); assertTrue(invoked.get()); }); }