CIDR: initial 'build' functionality

CIDR: read old-style SDK
CIDR: some refactoring
This commit is contained in:
Anton Makeev
2010-04-08 00:31:05 +04:00
parent 18a23833b3
commit 3781d7d6e3
2 changed files with 34 additions and 47 deletions
@@ -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;
}
@@ -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()) {