Add ThrowableRunnable to fix CCE

This commit is contained in:
Dmitry Gridin
2020-05-07 18:19:49 +07:00
parent 988c89602d
commit fb9562ca70
5 changed files with 17 additions and 13 deletions
@@ -106,9 +106,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
override fun tearDown() { override fun tearDown() {
runAll( runAll(
{ LoggedErrorProcessor.restoreDefaultProcessor() }, ThrowableRunnable { LoggedErrorProcessor.restoreDefaultProcessor() },
{ disableKotlinOfficialCodeStyle(project) }, ThrowableRunnable { disableKotlinOfficialCodeStyle(project) },
{ super.tearDown() }, ThrowableRunnable { super.tearDown() },
) )
if (exceptions.isNotEmpty()) { if (exceptions.isNotEmpty()) {
@@ -9,6 +9,7 @@ import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.openapi.startup.StartupManager import com.intellij.openapi.startup.StartupManager
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
import com.intellij.util.ThrowableRunnable
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestMetadata import org.jetbrains.kotlin.test.TestMetadata
import java.io.File import java.io.File
@@ -24,9 +25,9 @@ abstract class KotlinLightPlatformCodeInsightFixtureTestCase : LightPlatformCode
} }
override fun tearDown() = runAll( override fun tearDown() = runAll(
{ disableKotlinOfficialCodeStyle(project) }, ThrowableRunnable { disableKotlinOfficialCodeStyle(project) },
{ VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) }, ThrowableRunnable { VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) },
{ super.tearDown() }, ThrowableRunnable { super.tearDown() },
) )
protected fun testDataFile(fileName: String): File = File(testDataPath, fileName) protected fun testDataFile(fileName: String): File = File(testDataPath, fileName)
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.test
import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.testFramework.LightPlatformCodeInsightTestCase import com.intellij.testFramework.LightPlatformCodeInsightTestCase
import com.intellij.util.ThrowableRunnable
// BUNCH: 191 // BUNCH: 191
abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() { abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() {
@@ -20,7 +21,7 @@ abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsight
} }
override fun tearDown() = runAll( override fun tearDown() = runAll(
{ disableKotlinOfficialCodeStyle(project_) }, ThrowableRunnable { disableKotlinOfficialCodeStyle(project_) },
{ super.tearDown() }, ThrowableRunnable { super.tearDown() },
) )
} }
@@ -9,6 +9,7 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.testFramework.LightPlatformCodeInsightTestCase import com.intellij.testFramework.LightPlatformCodeInsightTestCase
import com.intellij.testFramework.LightPlatformTestCase import com.intellij.testFramework.LightPlatformTestCase
import com.intellij.util.ThrowableRunnable
// BUNCH: 191 // BUNCH: 191
abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() { abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsightTestCase() {
@@ -21,7 +22,7 @@ abstract class KotlinLightPlatformCodeInsightTestCase : LightPlatformCodeInsight
} }
override fun tearDown() = runAll( override fun tearDown() = runAll(
{ disableKotlinOfficialCodeStyle(project_) }, ThrowableRunnable { disableKotlinOfficialCodeStyle(project_) },
{ super.tearDown() }, ThrowableRunnable { super.tearDown() },
) )
} }
@@ -23,6 +23,7 @@ import com.intellij.openapi.vfs.VfsUtil
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import com.intellij.psi.PsiFile import com.intellij.psi.PsiFile
import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.PsiTestUtil
import com.intellij.util.ThrowableRunnable
import org.jetbrains.kotlin.config.CompilerSettings import org.jetbrains.kotlin.config.CompilerSettings
import org.jetbrains.kotlin.config.KotlinFacetSettings import org.jetbrains.kotlin.config.KotlinFacetSettings
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
@@ -63,9 +64,9 @@ abstract class AbstractMultiModuleTest : DaemonAnalyzerTestCase() {
} }
override fun tearDown() = runAll( override fun tearDown() = runAll(
{ VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) }, ThrowableRunnable { VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) },
{ disableKotlinOfficialCodeStyle(project) }, ThrowableRunnable { disableKotlinOfficialCodeStyle(project) },
{ super.tearDown() }, ThrowableRunnable { super.tearDown() },
) )
public override fun createModule(path: String, moduleType: ModuleType<*>): Module { public override fun createModule(path: String, moduleType: ModuleType<*>): Module {