Skip to content

Commit 3a21f63

Browse files
committed
(#291) Test: try migrating to JUnit 5
1 parent 63d86d4 commit 3a21f63

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/test/kotlin/com/intellij/plugin/powershell/ide/run/PowerShellRunConfigurationTests.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,53 @@ import com.intellij.execution.impl.RunManagerImpl
55
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl
66
import com.intellij.execution.runners.ExecutionEnvironment
77
import com.intellij.execution.runners.ProgramRunner
8-
import com.intellij.testFramework.fixtures.BasePlatformTestCase
8+
import com.intellij.openapi.project.Project
9+
import com.intellij.testFramework.junit5.TestApplication
10+
import com.intellij.testFramework.junit5.fixture.projectFixture
911
import kotlinx.coroutines.runBlocking
12+
import org.junit.Assert.assertEquals
13+
import org.junit.Test
1014
import java.nio.file.Path
1115
import kotlin.io.path.Path
1216

13-
class PowerShellRunConfigurationTests : BasePlatformTestCase() {
17+
@TestApplication
18+
class PowerShellRunConfigurationTests {
1419

20+
private val projectFixture = projectFixture()
21+
22+
private val project: Project
23+
get() = projectFixture.get()
1524
private val projectPath: Path
1625
get() = Path(project.basePath!!)
1726
private val defaultWorkingDirectory
1827
get() = projectPath.resolve("scripts")
1928

29+
@Test
2030
fun testCustomWorkingDirectoryPath() {
2131
val customDir = projectPath.resolve("ttt")
2232
assertWorkingDirectory(custom = customDir.toString(), expected = customDir)
2333
}
2434

35+
@Test
2536
fun testNoCustomWorkingDirectory() {
2637
assertWorkingDirectory(custom = null, expected = defaultWorkingDirectory)
2738
}
2839

40+
@Test
2941
fun testEmptyCustomWorkingDirectory() {
3042
assertWorkingDirectory(custom = "", expected = defaultWorkingDirectory)
3143
}
3244

45+
@Test
3346
fun testCustomWorkingDirectoryPathVariable() {
3447
assertWorkingDirectory(custom = "\$PROJECT_DIR$/foobar", expected = projectPath.resolve("foobar"))
3548
}
3649

50+
@Test
3751
fun testInvalidWorkingDir() {
3852
assertWorkingDirectory(custom = invalidPath, expected = defaultWorkingDirectory)
3953
}
54+
@Test
4055
fun testInvalidScriptPath() {
4156
assertWorkingDirectory(custom = null, scriptPath = invalidPath, expected = Path(System.getProperty("user.home")))
4257
}

0 commit comments

Comments
 (0)