Fix running JUnit test method in abstract class

Previously led to running all methods in an inheritor class
Untested because behaviour is rare and we don't have test covering JUnit run configuration

 #KT-28080 Fixed
This commit is contained in:
Pavel V. Talanov
2018-11-08 17:48:06 +01:00
parent aae023909d
commit 24f1db811a
@@ -107,7 +107,8 @@ class KotlinJUnitRunConfigurationProducer : RunConfigurationProducer<JUnitConfig
override fun onFirstRun(fromContext: ConfigurationFromContext, context: ConfigurationContext, performRunnable: Runnable) {
val leaf = fromContext.sourceElement
val sourceElement = getTestClass(leaf) ?: return super.onFirstRun(fromContext, context, performRunnable)
val sourceElement =
getTestMethod(leaf) as? PsiMember ?: getTestClass(leaf) ?: return super.onFirstRun(fromContext, context, performRunnable)
val contextWithLightElement = createDelegatingContextWithLightElement(fromContext, sourceElement)
// TODO: use TestClassConfigurationProducer when constructor becomes public