void () { Semaphore semaphore = new Semaphore(); semaphore.down(); ApplicationManager.getApplication().invokeLater(semaphore::up); assertTrue("invokeAndWait would deadlock", semaphore.waitFor(1000)); }