private void runBareInSwingThread() throws Throwable {
if (SwingUtilities.isEventDispatchThread()) {
super.runBare();
return;
}
final ExceptionContainer container = new ExceptionContainer();
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
FreeplaneTestCase.super.runBare();
}
catch (Throwable e) {
container.set(e);
}
}
});
}
catch (InterruptedException e) {
throw new RuntimeException(e.getCause());
}
catch (InvocationTargetException e) {
throw new RuntimeException(e.getCause());
}
container.rethrowIfNeeded();
}