aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/linking
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-04-19 13:11:38 +0300
committerGitHub <noreply@github.com>2022-04-19 13:11:38 +0300
commit3d573827230e7a750c002cf416cf9231161dd9b3 (patch)
tree9da32e97873536db521974a004929cbb0c8a29df /plugins/base/src/test/kotlin/linking
parent2a0ed52ff33c2ea38cf2bbd439a8b5af9f692d04 (diff)
downloaddokka-3d573827230e7a750c002cf416cf9231161dd9b3.tar.gz
dokka-3d573827230e7a750c002cf416cf9231161dd9b3.tar.bz2
dokka-3d573827230e7a750c002cf416cf9231161dd9b3.zip
Update Jsoup to 1.14.3 (#2448)
* Update Jsoup to 1.14.3 * Fix Jsoup API breaking changes after the update * Fix new Qodana inspections * Replace IllegalStateException with more appropriate NoSuchElementException
Diffstat (limited to 'plugins/base/src/test/kotlin/linking')
-rw-r--r--plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt32
1 files changed, 26 insertions, 6 deletions
diff --git a/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt b/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt
index 29e705fd..f95d9860 100644
--- a/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt
+++ b/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt
@@ -13,7 +13,7 @@ import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
import java.nio.file.Paths
import utils.TestOutputWriterPlugin
-import java.lang.AssertionError
+import kotlin.AssertionError
class EnumValuesLinkingTest : BaseAbstractTest() {
@@ -106,12 +106,32 @@ class EnumValuesLinkingTest : BaseAbstractTest() {
assertNotNull(content.dfs { it is ContentDRILink && it.address.classNames == "JavaEnum.ON_DECEIT" })
}
- // single method will throw an exception if there is no single element (0 or 2+)
- Jsoup.parse(writerPlugin.writer.contents["root/linking.source/-java-linker/index.html"]).select("a[href=\"../-kotlin-enum/-o-n_-c-r-e-a-t-e/index.html\"]").single()
- Jsoup.parse(writerPlugin.writer.contents["root/linking.source/-java-linker/index.html"]).select("a[href=\"../-java-enum/-o-n_-d-e-c-e-i-t/index.html\"]").single()
- Jsoup.parse(writerPlugin.writer.contents["root/linking.source/-kotlin-linker/index.html"]).select("a[href=\"../-kotlin-enum/-o-n_-c-r-e-a-t-e/index.html\"]").single()
- Jsoup.parse(writerPlugin.writer.contents["root/linking.source/-kotlin-linker/index.html"]).select("a[href=\"../-java-enum/-o-n_-d-e-c-e-i-t/index.html\"]").single()
+ Jsoup
+ .parse(writerPlugin.writer.contents.getValue("root/linking.source/-java-linker/index.html"))
+ .select("a[href=\"../-kotlin-enum/-o-n_-c-r-e-a-t-e/index.html\"]")
+ .assertOnlyOneElement()
+
+ Jsoup
+ .parse(writerPlugin.writer.contents.getValue("root/linking.source/-java-linker/index.html"))
+ .select("a[href=\"../-java-enum/-o-n_-d-e-c-e-i-t/index.html\"]")
+ .assertOnlyOneElement()
+
+ Jsoup
+ .parse(writerPlugin.writer.contents.getValue("root/linking.source/-kotlin-linker/index.html"))
+ .select("a[href=\"../-kotlin-enum/-o-n_-c-r-e-a-t-e/index.html\"]")
+ .assertOnlyOneElement()
+
+ Jsoup
+ .parse(writerPlugin.writer.contents.getValue("root/linking.source/-kotlin-linker/index.html"))
+ .select("a[href=\"../-java-enum/-o-n_-d-e-c-e-i-t/index.html\"]")
+ .assertOnlyOneElement()
}
}
}
+
+ private fun <T> List<T>.assertOnlyOneElement() {
+ if (isEmpty() || size > 1) {
+ throw AssertionError("Single element expected in list: $this")
+ }
+ }
}