From 4f5a5bc370c38109cab13534fee18acc472d6e7f Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 27 Jan 2010 18:58:09 +0300 Subject: [PATCH] extend test framework: isTestMethodOrConfig --- java/openapi/src/com/intellij/codeInsight/TestFramework.java | 2 ++ .../src/com/intellij/execution/junit/JUnitTestFramework.java | 4 ++++ .../src/com/theoryinpractice/testng/util/TestNGUtil.java | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/java/openapi/src/com/intellij/codeInsight/TestFramework.java b/java/openapi/src/com/intellij/codeInsight/TestFramework.java index 195e188b64ce..037425648b9e 100644 --- a/java/openapi/src/com/intellij/codeInsight/TestFramework.java +++ b/java/openapi/src/com/intellij/codeInsight/TestFramework.java @@ -27,4 +27,6 @@ import com.intellij.util.IncorrectOperationException; public interface TestFramework { boolean isTestKlass(PsiClass psiClass); PsiMethod findSetUpMethod(PsiClass psiClass) throws IncorrectOperationException; + + boolean isTestMethodOrConfig(PsiMethod psiMethod); } \ No newline at end of file diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitTestFramework.java b/plugins/junit/src/com/intellij/execution/junit/JUnitTestFramework.java index 91c8b56b3745..5abcc25cf8df 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitTestFramework.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitTestFramework.java @@ -66,4 +66,8 @@ public class JUnitTestFramework implements TestFramework { } return inClass; } + + public boolean isTestMethodOrConfig(PsiMethod psiMethod) { + return JUnitUtil.isTestMethodOrConfig(psiMethod); + } } \ No newline at end of file diff --git a/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java b/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java index aef188828bbe..24cc13eaeedd 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java +++ b/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java @@ -477,6 +477,10 @@ public class TestNGUtil implements TestFramework return inClass; } + public boolean isTestMethodOrConfig(PsiMethod psiMethod) { + return hasTest(psiMethod) || hasConfig(psiMethod); + } + public static boolean checkTestNGInClasspath(PsiElement psiElement) { final Project project = psiElement.getProject(); final PsiManager manager = PsiManager.getInstance(project);