diff --git a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinMultiFileTestCase.kt b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinMultiFileTestCase.kt index f7a877bfee6..4270b923489 100644 --- a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinMultiFileTestCase.kt +++ b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinMultiFileTestCase.kt @@ -17,15 +17,15 @@ package org.jetbrains.kotlin.idea.test import com.intellij.ide.highlighter.ModuleFileType -import com.intellij.openapi.module.StdModuleTypes +import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileVisitor import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess import com.intellij.refactoring.MultiFileTestCase import com.intellij.testFramework.PsiTestUtil +import org.jetbrains.kotlin.idea.util.application.runWriteAction import org.jetbrains.kotlin.test.KotlinTestUtils -import java.io.File abstract class KotlinMultiFileTestCase : MultiFileTestCase() { protected var isMultiModule = false @@ -37,14 +37,14 @@ abstract class KotlinMultiFileTestCase : MultiFileTestCase() { override fun prepareProject(rootDir: VirtualFile) { if (isMultiModule) { + val model = ModuleManager.getInstance(project).modifiableModel + VfsUtilCore.visitChildrenRecursively( rootDir, object : VirtualFileVisitor() { override fun visitFile(file: VirtualFile): Boolean { if (!file.isDirectory && file.name.endsWith(ModuleFileType.DOT_DEFAULT_EXTENSION)) { - val module = createModule(File(file.path), StdModuleTypes.JAVA) - val contentRoot = file.parent.findChild("src")!! - PsiTestUtil.addSourceContentToRoots(module, contentRoot) + model.loadModule(file.path) return false } @@ -52,6 +52,8 @@ abstract class KotlinMultiFileTestCase : MultiFileTestCase() { } } ) + + runWriteAction { model.commit() } } else { PsiTestUtil.addSourceContentToRoots(myModule, rootDir) diff --git a/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/after/A/A.iml b/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/after/A/A.iml index 7c331a99b04..245d3429faa 100644 --- a/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/after/A/A.iml +++ b/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/after/A/A.iml @@ -8,6 +8,5 @@ - \ No newline at end of file diff --git a/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/before/A/A.iml b/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/before/A/A.iml index 7c331a99b04..245d3429faa 100644 --- a/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/before/A/A.iml +++ b/idea/testData/refactoring/moveMultiModule/moveInternalToAnotherModule/before/A/A.iml @@ -8,6 +8,5 @@ - \ No newline at end of file