mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[rdct tests] refactoring: convert tests in intellij.remoteDev.util module to JUnit5
...and simplify ClientVersionUtilTest using parameterized tests. GitOrigin-RevId: da96ef4a92674cde5bd3c840a6b406a078c69584
This commit is contained in:
committed by
intellij-monorepo-bot
parent
464a3c3031
commit
aa3ebab95b
@@ -47,7 +47,9 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.rd.community" />
|
||||
<orderEntry type="module" module-name="intellij.platform.statistics" />
|
||||
<orderEntry type="library" name="gson" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit5" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit5Params" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework.junit5" scope="TEST" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-core" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-json" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
|
||||
@@ -1,41 +1,21 @@
|
||||
package com.intellij.remoteDev.util
|
||||
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import com.intellij.remoteDev.util.ClientVersionUtil.isJBCSeparateConfigSupported
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.ValueSource
|
||||
|
||||
class ClientVersionUtilTest {
|
||||
@Test
|
||||
fun `233_173 is supported`() {
|
||||
Assert.assertTrue(ClientVersionUtil.isJBCSeparateConfigSupported("233.173"))
|
||||
@ValueSource(strings = ["233.173", "233.SNAPSHOT", "241.1", "241.SNAPSHOT"])
|
||||
@ParameterizedTest
|
||||
fun `supported version`(version: String) {
|
||||
assertTrue(isJBCSeparateConfigSupported(version))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `233_172 is not supported`() {
|
||||
Assert.assertFalse(ClientVersionUtil.isJBCSeparateConfigSupported("233.172"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `232_9999 is not supported`() {
|
||||
Assert.assertFalse(ClientVersionUtil.isJBCSeparateConfigSupported("232.9999"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `241_1 is supported`() {
|
||||
Assert.assertTrue(ClientVersionUtil.isJBCSeparateConfigSupported("241.1"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `241_SNAPSHOT is supported`() {
|
||||
Assert.assertTrue(ClientVersionUtil.isJBCSeparateConfigSupported("241.SNAPSHOT"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `233_SNAPSHOT is supported`() {
|
||||
Assert.assertTrue(ClientVersionUtil.isJBCSeparateConfigSupported("233.SNAPSHOT"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `232_SNAPSHOT is not supported`() {
|
||||
Assert.assertFalse(ClientVersionUtil.isJBCSeparateConfigSupported("232.SNAPSHOT"))
|
||||
@ValueSource(strings = ["233.172", "232.SNAPSHOT", "232.9999"])
|
||||
@ParameterizedTest
|
||||
fun `not supported versions`(version: String) {
|
||||
assertFalse(isJBCSeparateConfigSupported(version))
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.intellij.remoteDev.util
|
||||
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import java.net.URI
|
||||
|
||||
class UrlUtilTest {
|
||||
@@ -20,12 +21,14 @@ class UrlUtilTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException::class)
|
||||
@Test
|
||||
fun addPathSuffix_no_path() {
|
||||
URI("http://127.0.0.1").addPathSuffix("some")
|
||||
assertThrows<IllegalStateException> {
|
||||
URI("http://127.0.0.1").addPathSuffix("some")
|
||||
}
|
||||
}
|
||||
|
||||
private fun testAddPathSuffix(original: String, suffix: String, result: String) {
|
||||
Assert.assertEquals(result, URI(original).addPathSuffix(suffix).toString())
|
||||
assertEquals(result, URI(original).addPathSuffix(suffix).toString())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user