loadAndOpenProject - accept File and VirtualFile to reduce usages of unclear strings in tests

GitOrigin-RevId: 77b3a5ca43a720be0be4c759909412404bdff880
This commit is contained in:
Vladimir Krivosheev
2019-06-11 18:06:30 +03:00
committed by intellij-monorepo-bot
parent 5ac4802e3b
commit 7839d203ef
8 changed files with 83 additions and 72 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.roots
import com.intellij.openapi.application.ex.PathManagerEx
@@ -24,6 +10,7 @@ import com.intellij.openapi.project.impl.ProjectManagerImpl
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.ModuleRootModificationUtil
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.openapi.vfs.VfsUtilCore
import com.intellij.testFramework.ModuleTestCase
import java.io.File
@@ -33,7 +20,7 @@ import java.io.File
*/
class UnloadedModulesConfigurationTest : ModuleTestCase() {
fun `test load project`() {
val projectPath = File(PathManagerEx.getTestDataPath(), "moduleRootManager/unloadedModules").absolutePath
val projectPath = FileUtilRt.toSystemIndependentName(File(PathManagerEx.getTestDataPath(), "moduleRootManager/unloadedModules").absolutePath)
val project = getProjectManager().loadAndOpenProject(projectPath)!!
try {
val moduleManager = ModuleManager.getInstance(project)
@@ -41,7 +28,7 @@ class UnloadedModulesConfigurationTest : ModuleTestCase() {
assertEquals(2, moduleManager.unloadedModuleDescriptions.size)
val util = moduleManager.unloadedModuleDescriptions.find { it.name == "util" }!!
val projectDirUrl = VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(projectPath))
val projectDirUrl = VfsUtilCore.pathToUrl(projectPath)
assertEquals("$projectDirUrl/util", assertOneElement(util.contentRoots).url)
assertEmpty(util.dependencyModuleNames)