mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
...and simplify ClientVersionUtilTest using parameterized tests. GitOrigin-RevId: da96ef4a92674cde5bd3c840a6b406a078c69584
34 lines
788 B
Kotlin
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())
|
|
}
|
|
} |