add setup method before first test method: setting needed? (IDEA-61605)

This commit is contained in:
anna
2010-11-25 16:21:55 +03:00
parent 5ebb6cc3c2
commit cd5b299bf4
8 changed files with 49 additions and 18 deletions
@@ -31,6 +31,7 @@ import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.containers.Convertor;
import junit.runner.BaseTestRunner;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -209,6 +210,18 @@ public class JUnitUtil {
return false;
}
@Nullable
protected static PsiMethod findFirstTestMethod(PsiClass clazz) {
PsiMethod testMethod = null;
for (PsiMethod method : clazz.getMethods()) {
if (isTestMethod(MethodLocation.elementInClass(method, clazz)) || isSuiteMethod(method)) {
testMethod = method;
break;
}
}
return testMethod;
}
public static class TestMethodFilter implements Condition<PsiMethod> {
private final PsiClass myClass;