mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit: treat test methods in abstract test cases as tests (IDEA-174710)
This commit is contained in:
@@ -172,10 +172,6 @@ public abstract class JavaTestFramework implements TestFramework {
|
||||
return isTestMethod(element, true);
|
||||
}
|
||||
|
||||
public boolean isTestMethod(PsiElement element, boolean checkAbstract) {
|
||||
return isTestMethod(element);
|
||||
}
|
||||
|
||||
public boolean isMyConfigurationType(ConfigurationType type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,10 @@ public interface TestFramework {
|
||||
* should be checked for abstract method error
|
||||
*/
|
||||
boolean isTestMethod(PsiElement element);
|
||||
|
||||
default boolean isTestMethod(PsiElement element, boolean checkAbstract) {
|
||||
return isTestMethod(element);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
Language getLanguage();
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class TestUtils {
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass == null) return false;
|
||||
final TestFramework framework = TestFrameworks.detectFramework(containingClass);
|
||||
return framework != null && framework.getName().startsWith("JUnit") && framework.isTestMethod(method);
|
||||
return framework != null && framework.getName().startsWith("JUnit") && framework.isTestMethod(method, false);
|
||||
}
|
||||
|
||||
public static boolean isRunnable(PsiMethod method) {
|
||||
|
||||
+7
-1
@@ -16,4 +16,10 @@ public class <warning descr="JUnit test case 'TestCaseWithNoTestMethods' has no
|
||||
public void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractTest extends junit.framework.TestCase {
|
||||
public void testInAbstract() {}
|
||||
}
|
||||
|
||||
class MyImplTest extends AbstractTest {}
|
||||
+3
-1
@@ -29,7 +29,9 @@ public class TestCaseWithNoTestMethodsInspectionTest extends LightInspectionTest
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new TestCaseWithNoTestMethodsInspection();
|
||||
TestCaseWithNoTestMethodsInspection inspection = new TestCaseWithNoTestMethodsInspection();
|
||||
inspection.ignoreSupers = true;
|
||||
return inspection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user