Skip to content

Commit bd94b74

Browse files
authored
Use VfsUtil.createDirectories in test setup methods (#246)
1 parent a063d3e commit bd94b74

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

plugins/WorkspaceMcpTools/src/test/kotlin/dev/ghostflyby/mcp/rest/FileAccessPolicyRoutesTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2026 ghostflyby
3+
* SPDX-FileCopyrightText: 2026 ghostflyby
4+
* SPDX-License-Identifier: LGPL-3.0-or-later
5+
*/
6+
17
package dev.ghostflyby.mcp.rest
28

39
import com.intellij.openapi.application.ApplicationManager

plugins/WorkspaceMcpTools/src/test/kotlin/dev/ghostflyby/mcp/rest/RestSessionRoutesTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ package dev.ghostflyby.mcp.rest
99
import com.intellij.openapi.application.ApplicationManager
1010
import com.intellij.openapi.components.service
1111
import com.intellij.openapi.roots.ModuleRootManager
12+
import com.intellij.openapi.util.io.toCanonicalPath
1213
import com.intellij.openapi.vfs.LocalFileSystem
14+
import com.intellij.openapi.vfs.VfsUtil
1315
import com.intellij.testFramework.IndexingTestUtil
1416
import com.intellij.testFramework.junit5.TestApplication
1517
import com.intellij.testFramework.junit5.fixture.*
@@ -52,7 +54,7 @@ internal class RestSessionRoutesTest {
5254
@BeforeEach
5355
fun refresh() {
5456
val nestedRootPath = projectPathFixture.get().resolve("nested-session-root")
55-
nestedRootPath.createDirectories()
57+
val nestedRoot = VfsUtil.createDirectories(nestedRootPath.toCanonicalPath())
5658
nestedRootPath.resolve("NestedRootFile.kt").writeText("class NestedRootFile")
5759
val globDir = projectPathFixture.get().resolve("glob")
5860
globDir.resolve("nested").createDirectories()
@@ -65,8 +67,6 @@ internal class RestSessionRoutesTest {
6567
externalPathFixture.get().resolve("nested").createDirectories()
6668
externalPathFixture.get().resolve("nested/ExternalSearch.kt")
6769
.writeText("""class ExternalSearch { val marker = "external needle" }""")
68-
val nestedRoot = LocalFileSystem.getInstance().refreshAndFindFileByNioFile(nestedRootPath)
69-
?: error("nested root missing")
7070
ApplicationManager.getApplication().runWriteAction {
7171
val model = ModuleRootManager.getInstance(moduleFixture.get()).modifiableModel
7272
var committed = false

0 commit comments

Comments
 (0)