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