mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[kotlin] Make 'TestNgKotlinTestFrameworkProvider' a class (KTIJ-24476)
Extensions are instantiated by the platform, breaking the objects' singleton contract. GitOrigin-RevId: c606bfc71bc8fa7086663a7023503ce0cc3da6f6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4103031a17
commit
77c55a7e7f
@@ -41,7 +41,7 @@ public class KotlinTestNgConfigurationProducer extends TestNGConfigurationProduc
|
||||
@NotNull TestNGConfiguration configuration,
|
||||
@NotNull ConfigurationContext context, @NotNull PsiElement element
|
||||
) {
|
||||
KotlinTestFrameworkProvider.JavaEntity javaEntity = TestNgKotlinTestFrameworkProvider.INSTANCE.getJavaEntity(element);
|
||||
KotlinTestFrameworkProvider.JavaEntity javaEntity = TestNgKotlinTestFrameworkProvider.getInstance().getJavaEntity(element);
|
||||
if (javaEntity == null || !hasDetectedTestFramework(javaEntity.getTestClass())) {
|
||||
return false;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class KotlinTestNgConfigurationProducer extends TestNGConfigurationProduc
|
||||
return false;
|
||||
}
|
||||
|
||||
JavaTestEntity testEntity = TestNgKotlinTestFrameworkProvider.INSTANCE.getJavaTestEntity(leaf, true);
|
||||
JavaTestEntity testEntity = TestNgKotlinTestFrameworkProvider.getInstance().getJavaTestEntity(leaf, true);
|
||||
if (testEntity == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -85,7 +85,9 @@ public class KotlinTestNgConfigurationProducer extends TestNGConfigurationProduc
|
||||
|
||||
@Override
|
||||
public void onFirstRun(ConfigurationFromContext configuration, @NotNull ConfigurationContext context, @NotNull Runnable startRunnable) {
|
||||
JavaTestEntity testEntity = TestNgKotlinTestFrameworkProvider.INSTANCE.getJavaTestEntity(configuration.getSourceElement(), true);
|
||||
JavaTestEntity testEntity = TestNgKotlinTestFrameworkProvider.getInstance()
|
||||
.getJavaTestEntity(configuration.getSourceElement(), true);
|
||||
|
||||
if (testEntity == null) {
|
||||
super.onFirstRun(configuration, context, startRunnable);
|
||||
return;
|
||||
|
||||
@@ -10,11 +10,21 @@ import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.util.PsiClassUtil
|
||||
import com.theoryinpractice.testng.configuration.TestNGConfigurationProducer
|
||||
import com.theoryinpractice.testng.util.TestNGUtil
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.kotlin.idea.base.codeInsight.FrameworkAvailabilityChecker
|
||||
import org.jetbrains.kotlin.idea.base.codeInsight.isFrameworkAvailable
|
||||
import org.jetbrains.kotlin.idea.extensions.KotlinTestFrameworkProvider
|
||||
|
||||
object TestNgKotlinTestFrameworkProvider : KotlinTestFrameworkProvider {
|
||||
@ApiStatus.Internal
|
||||
class TestNgKotlinTestFrameworkProvider : KotlinTestFrameworkProvider {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(): TestNgKotlinTestFrameworkProvider {
|
||||
return KotlinTestFrameworkProvider.EP_NAME
|
||||
.findExtensionOrFail(TestNgKotlinTestFrameworkProvider::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override val canRunJvmTests: Boolean
|
||||
get() = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user