From 3bb67f5b1b05a66f8babb8119b6d334ab4e5797a Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Wed, 2 Sep 2015 15:37:27 +0300 Subject: [PATCH] UsefulTestCase.edt: explicitly rethrow the exception This is already done in invokeAndWaitIfNeeded via LOG.error, but making it more explicit won't hurt, especially if LOG.error stops throwing exception in tests. Also accept ThrowableRunnable. --- .../testFramework/UsefulTestCase.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index 399340124fbb..aad28bc65d90 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -348,13 +348,29 @@ public abstract class UsefulTestCase extends TestCase { return PlatformTestUtil.canRunTest(getClass()); } - public static void edt(Runnable r) { - UIUtil.invokeAndWaitIfNeeded(r); + public static void edt(@NotNull final ThrowableRunnable r) { + try { + UIUtil.invokeAndWaitIfNeeded(r); + } + catch (RuntimeException re) { + throw re; + } + catch (Throwable throwable) { + throw new RuntimeException(throwable); + } + } + + public static void edt(@NotNull final Runnable r) { + edt(new ThrowableRunnable() { + @Override + public void run() throws Throwable { + r.run(); + } + }); } protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception { - UIUtil.invokeAndWaitIfNeeded(runnable); - //runnable.run(); + edt(runnable); } protected void defaultRunBare() throws Throwable {