diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JvmIdePlatformKindTooling.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JvmIdePlatformKindTooling.kt index ef1b71d4944..af5b332a74f 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JvmIdePlatformKindTooling.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JvmIdePlatformKindTooling.kt @@ -68,7 +68,7 @@ class JvmIdePlatformKindTooling : IdePlatformKindTooling() { val lightMethod = declaration.toLightMethods().firstOrNull() ?: return null val lightClass = lightMethod.containingClass as? KtLightClass ?: return null val framework = TestFrameworks.detectFramework(lightClass) ?: return null - if (!framework.isTestMethod(lightMethod)) return null + if (!framework.isTestMethod(lightMethod, /*checkAbstract = */ false)) return null "java:test://${lightClass.qualifiedName}.${lightMethod.name}" to framework } diff --git a/idea/testData/codeInsight/lineMarker/runMarkers/jUnitTestClassWithSubclasses.kt b/idea/testData/codeInsight/lineMarker/runMarkers/jUnitTestClassWithSubclasses.kt index 5245b84fe1c..f5720a114ef 100644 --- a/idea/testData/codeInsight/lineMarker/runMarkers/jUnitTestClassWithSubclasses.kt +++ b/idea/testData/codeInsight/lineMarker/runMarkers/jUnitTestClassWithSubclasses.kt @@ -5,12 +5,14 @@ import junit.framework.TestCase import org.junit.Test abstract class KBase : TestCase() { + // NOTE: this differs from Java tooling behaviour, see KT-27977 @Test - fun testFoo() { + fun testFoo() { } } + class KTest : KBase() { @Test fun testBar() { @@ -23,4 +25,13 @@ class KTest2 : KBase() { fun testBaz() { } -} \ No newline at end of file +} + +abstract class AbstractClassWithoutInheritors : TestCase() { + // NOTE: showing line markers for abstract method, which has no inheritors is not ideal, because those methods cannot actually be run + // Sadly, run configurations can actually be created for them (same in Java), so this behaviour is consistent with context menu + @Test + fun testFoo() { + + } +}