void (@NotNull Runnable test) { if (EventQueue.isDispatchThread()) { test.run(); } else { try { EventQueue.invokeAndWait(test); } catch (InterruptedException exception) { throw new AssertionError(exception); } catch (InvocationTargetException exception) { Throwable target = exception.getTargetException(); ExceptionUtil.rethrowUnchecked(target); throw new AssertionError(target != null ? target : exception); } } }