diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 index 96372ee9bbe..1d2a7c781e9 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 @@ -155,7 +155,7 @@ public class KotlinConfidenceTest extends LightCompletionTestCase { new CodeCompletionHandlerBase(CompletionType.BASIC, false, true, true).invokeCompletion( getProject(), getEditor(), 0, false); - LookupImpl lookup = (LookupImpl) LookupManager.getActiveLookup(myEditor); + LookupImpl lookup = (LookupImpl) LookupManager.getActiveLookup(getEditor()); myItems = lookup == null ? null : lookup.getItems().toArray(LookupElement.EMPTY_ARRAY); myPrefix = lookup == null ? null : lookup.itemPattern(lookup.getItems().get(0)); } diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 index 42fdde3a79e..ec5a3335471 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 @@ -31,7 +31,7 @@ import org.gradle.tooling.model.DomainObjectSet; import org.gradle.tooling.model.idea.IdeaModule; import org.gradle.util.GradleVersion; import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.gradle.model.ClassSetProjectImportExtraModelProvider; +import org.jetbrains.plugins.gradle.model.ClassSetProjectImportModelProvider; import org.jetbrains.plugins.gradle.model.ExternalProject; import org.jetbrains.plugins.gradle.model.ProjectImportAction; import org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper; @@ -141,7 +141,7 @@ public abstract class AbstractModelBuilderTest { try { ProjectImportAction projectImportAction = new ProjectImportAction(false); - projectImportAction.addProjectImportExtraModelProvider(new ClassSetProjectImportExtraModelProvider(getModels())); + projectImportAction.addProjectImportModelProvider(new ClassSetProjectImportModelProvider(getModels())); BuildActionExecuter buildActionExecutor = connection.action(projectImportAction); File initScript = GradleExecutionHelper.generateInitScript(false, getToolingExtensionClasses()); assertNotNull(initScript); @@ -196,7 +196,7 @@ public abstract class AbstractModelBuilderTest { Map map = ContainerUtil.map2Map(ideaModules, new Function>() { @Override public Pair fun(IdeaModule module) { - T value = allModels.getExtraProject(module, aClass); + T value = allModels.getModel(module, aClass); String key = value != null ? module.getGradleProject().getPath() : filterKey; return Pair.create(key, value); } diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt.as40 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt.as40 index e44198d0879..2461ca991fa 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt.as40 +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt.as40 @@ -14,26 +14,24 @@ import com.intellij.openapi.module.Module import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile import com.intellij.testFramework.LightIdeaTestCase -import com.intellij.testFramework.LightPlatformCodeInsightTestCase -import com.intellij.testFramework.LightPlatformTestCase // BUNCH: as36, 191 @Suppress("DEPRECATION") @Deprecated("Use KotlinLightCodeInsightFixtureTestCase instead") abstract class KotlinLightCodeInsightTestCase : com.intellij.testFramework.LightCodeInsightTestCase() { - protected inline val project_: Project get() = LightPlatformTestCase.getProject() - protected inline val module_: Module get() = LightPlatformTestCase.getModule() - protected inline val editor_: Editor get() = LightPlatformCodeInsightTestCase.getEditor() - protected inline val file_: PsiFile get() = LightPlatformCodeInsightTestCase.getFile() - protected inline val currentEditorDataContext_: DataContext get() = LightPlatformCodeInsightTestCase.getCurrentEditorDataContext() + protected inline val project_: Project get() = project + protected inline val module_: Module get() = module + protected inline val editor_: Editor get() = editor + protected inline val file_: PsiFile get() = file + protected inline val currentEditorDataContext_: DataContext get() = currentEditorDataContext protected fun configureFromFileText_(fileName: String, fileText: String): Document { - return LightPlatformCodeInsightTestCase.configureFromFileText(fileName, fileText, false) + return configureFromFileText(fileName, fileText, false) } } // BUNCH: as36, 191 abstract class KotlinLightIdeaTestCase : LightIdeaTestCase() { - protected inline val project_: Project get() = LightPlatformTestCase.getProject() - protected inline val module_: Module get() = LightPlatformTestCase.getModule() + protected inline val project_: Project get() = project + protected inline val module_: Module get() = module } \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 index 251877e099f..418a1681e4f 100644 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 @@ -10,7 +10,6 @@ import com.intellij.debugger.streams.wrapper.StreamChainBuilder import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.projectRoots.Sdk import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable -import com.intellij.testFramework.LightPlatformTestCase import com.intellij.testFramework.PsiTestUtil import junit.framework.TestCase import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime @@ -34,18 +33,18 @@ abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) : super.setUp() ApplicationManager.getApplication().runWriteAction { @Suppress("UnstableApiUsage") - if (ProjectLibraryTable.getInstance(LightPlatformTestCase.getProject()).getLibraryByName(stdLibName) == null) { + if (ProjectLibraryTable.getInstance(project).getLibraryByName(stdLibName) == null) { val stdLibPath = ForTestCompileRuntime.runtimeJarForTests() PsiTestUtil.addLibrary( testRootDisposable, - LightPlatformTestCase.getModule(), + module, stdLibName, stdLibPath.parent, stdLibPath.name ) } } - LibraryModificationTracker.getInstance(LightPlatformTestCase.getProject()).incModificationCount() + LibraryModificationTracker.getInstance(project).incModificationCount() } diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/moveUpDown/AbstractCodeMoverTest.kt.as40 b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/moveUpDown/AbstractCodeMoverTest.kt.as40 index 21c296ff460..1620d908bbd 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/moveUpDown/AbstractCodeMoverTest.kt.as40 +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/moveUpDown/AbstractCodeMoverTest.kt.as40 @@ -16,7 +16,6 @@ import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.editor.actionSystem.EditorAction import com.intellij.openapi.extensions.Extensions import com.intellij.openapi.util.io.FileUtil -import com.intellij.testFramework.LightPlatformCodeInsightTestCase import junit.framework.ComparisonFailure import junit.framework.TestCase import org.jetbrains.kotlin.formatter.FormatSettingsUtil @@ -42,7 +41,7 @@ abstract class AbstractMoveStatementTest : AbstractCodeMoverTest() { val movers = Extensions.getExtensions(StatementUpDownMover.STATEMENT_UP_DOWN_MOVER_EP) val info = StatementUpDownMover.MoveInfo() val actualMover = movers.firstOrNull { - it.checkAvailable(LightPlatformCodeInsightTestCase.getEditor(), LightPlatformCodeInsightTestCase.getFile(), info, direction == "down") + it.checkAvailable(editor, file, info, direction == "down") } ?: error("No mover found") assertEquals("Unmatched movers", defaultMoverClass.name, actualMover::class.java.name) @@ -53,7 +52,7 @@ abstract class AbstractMoveStatementTest : AbstractCodeMoverTest() { abstract class AbstractMoveLeftRightTest : AbstractCodeMoverTest() { protected fun doTest(path: String) { - doTest(path) { _, _ -> } + doTest(path) { _, _ -> } } } @@ -73,8 +72,7 @@ abstract class AbstractCodeMoverTest : KotlinLightCodeInsightTestCase() { configureByFile(path) val fileText = FileUtil.loadFile(File(path), true) - val direction = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVE: ") - ?: error("No MOVE directive found") + val direction = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVE: ") ?: error("No MOVE directive found") val action = when (direction) { "up" -> MoveStatementUpAction() @@ -112,16 +110,14 @@ abstract class AbstractCodeMoverTest : KotlinLightCodeInsightTestCase() { TestCase.assertEquals(isApplicableExpected, !actionDoesNothing) if (isApplicableExpected) { - val afterFilePath = path + ".after" + val afterFilePath = "$path.after" try { checkResultByFile(afterFilePath) - } - catch (e: ComparisonFailure) { + } catch (e: ComparisonFailure) { KotlinTestUtils.assertEqualsToFile(File(afterFilePath), editor) } } - } - finally { + } finally { codeStyleSettings.clearCodeStyleSettings() } } diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 index beda0e405d4..54c73e1801e 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 @@ -191,8 +191,10 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() { val element = file.findElementForRename(editor.caretModel.offset)!! assertNotNull(element) - val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element, - getCurrentEditorDataContext()) + val dataContext = SimpleDataContext.getSimpleContext( + CommonDataKeys.PSI_ELEMENT.name, element, + getCurrentEditorDataContext() + ) val handler = RenameKotlinImplicitLambdaParameter() assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element) @@ -231,25 +233,23 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() { private fun doTestInplaceRename(newName: String?, handler: VariableInplaceRenameHandler = KotlinVariableInplaceRenameHandler()) { configureByFile(getTestName(false) + ".kt") val element = TargetElementUtil.findTargetElement( - myEditor, + editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED ) assertNotNull(element) - val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element!!, - getCurrentEditorDataContext()) + val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element!!, currentEditorDataContext) if (newName == null) { assertFalse(handler.isRenaming(dataContext), "In-place rename is allowed for " + element) - } - else { + } else { try { assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element) CodeInsightTestUtil.doInlineRename(handler, newName, getEditor(), element) checkResultByFile(getTestName(false) + ".kt.after") } catch (e: BaseRefactoringProcessor.ConflictsInTestsException) { - val expectedMessage = InTextDirectivesUtils.findStringWithPrefixes(myFile.text, "// SHOULD_FAIL_WITH: ") + val expectedMessage = InTextDirectivesUtils.findStringWithPrefixes(file.text, "// SHOULD_FAIL_WITH: ") TestCase.assertEquals(expectedMessage, e.messages.joinToString()) } }