diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java index 8bbf90165ca0..1fdd67c6c14f 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java @@ -498,53 +498,6 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro SwingUtilities.invokeAndWait(runnable); } - protected void runTest() throws Throwable { - /* - Method runMethod = null; - try { - runMethod = getClass().getMethod(getName(), new Class[0]); - } - catch (NoSuchMethodException e) { - fail("Method \"" + getName() + "\" not found"); - } - if (runMethod != null && !Modifier.isPublic(runMethod.getModifiers())) { - fail("Method \"" + getName() + "\" should be public"); - } - - final Method method = runMethod; - */ - - final Throwable[] throwables = new Throwable[1]; - - Runnable runnable = new Runnable() { - public void run() { - try { - PlatformTestCase.super.runTest(); - /* - method.invoke(IdeaTestCase.this, new Class[0]); - */ - } - catch (InvocationTargetException e) { - e.fillInStackTrace(); - throwables[0] = e.getTargetException(); - } - catch (IllegalAccessException e) { - e.fillInStackTrace(); - throwables[0] = e; - } - catch (Throwable e) { - throwables[0] = e; - } - } - }; - - invokeTestRunnable(runnable); - - if (throwables[0] != null) { - throw throwables[0]; - } - } - protected boolean isRunInWriteAction() { return true; } diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index d7f645c12ebe..648c9d945c05 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -47,6 +47,7 @@ import org.jetbrains.annotations.Nullable; import java.io.FileReader; import java.io.IOException; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.*; @@ -154,6 +155,39 @@ public abstract class UsefulTestCase extends TestCase { return myTestRootDisposable; } + protected void runTest() throws Throwable { + final Throwable[] throwables = new Throwable[1]; + + Runnable runnable = new Runnable() { + public void run() { + try { + UsefulTestCase.super.runTest(); + } + catch (InvocationTargetException e) { + e.fillInStackTrace(); + throwables[0] = e.getTargetException(); + } + catch (IllegalAccessException e) { + e.fillInStackTrace(); + throwables[0] = e; + } + catch (Throwable e) { + throwables[0] = e; + } + } + }; + + invokeTestRunnable(runnable); + + if (throwables[0] != null) { + throw throwables[0]; + } + } + + protected void invokeTestRunnable(Runnable runnable) throws Exception { + runnable.run(); + } + @NonNls public static String toString(Collection collection) { if (collection.isEmpty()) {