@Test
public void testInvokeAndWait() throws Exception {

    assertThat(SwingUtilities.isEventDispatchThread(), is(false));
    
    Callable<Boolean> callable = new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
            assertThat(SwingUtilities.isEventDispatchThread(), is(true));
            
            //wait a long time
            Thread.sleep(1000);
            
            return true;
        }
    };
    
    long start = System.currentTimeMillis();
    assertThat(SwingXUtilities.invokeAndWait(callable), is(true));
    assertThat((System.currentTimeMillis() - start) > 1000, is(true));
}