Files
Nikolay Chashnikov aa3ebab95b [rdct tests] refactoring: convert tests in intellij.remoteDev.util module to JUnit5
...and simplify ClientVersionUtilTest using parameterized tests.

GitOrigin-RevId: da96ef4a92674cde5bd3c840a6b406a078c69584
2023-07-19 16:40:55 +00:00

34 lines
788 B
Kotlin

package com.intellij.remoteDev.util
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 {
@Test
fun addPathSuffix() {
testAddPathSuffix(
"http://127.0.0.1/a.file?x=y#z",
".sha256",
"http://127.0.0.1/a.file.sha256?x=y#z"
)
testAddPathSuffix(
"http://127.0.0.1/",
".sha256",
"http://127.0.0.1/.sha256"
)
}
@Test
fun addPathSuffix_no_path() {
assertThrows<IllegalStateException> {
URI("http://127.0.0.1").addPathSuffix("some")
}
}
private fun testAddPathSuffix(original: String, suffix: String, result: String) {
assertEquals(result, URI(original).addPathSuffix(suffix).toString())
}
}