aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/utils/TestUtils.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-30 15:58:46 +0200
committerGitHub <noreply@github.com>2023-08-30 15:58:46 +0200
commitc63ea36637ce956029fb15b1482c0683ecb8a587 (patch)
tree2b75a8a976b43530820e73dc60cce4b10d9fc005 /plugins/base/src/test/kotlin/utils/TestUtils.kt
parent0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (diff)
downloaddokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.gz
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.bz2
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.zip
Migrate to JUnit 5 and unify used test API (#3138)
Diffstat (limited to 'plugins/base/src/test/kotlin/utils/TestUtils.kt')
-rw-r--r--plugins/base/src/test/kotlin/utils/TestUtils.kt9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt
index 8cb126d5..8b794af0 100644
--- a/plugins/base/src/test/kotlin/utils/TestUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt
@@ -4,10 +4,11 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.model.doc.P
-import org.junit.jupiter.api.Assertions.assertEquals
-import org.junit.jupiter.api.Assertions.assertTrue
import kotlin.collections.orEmpty
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
import kotlin.test.asserter
+import kotlin.test.fail
@DslMarker
annotation class TestDSL
@@ -25,7 +26,7 @@ abstract class ModelDSL : BaseAbstractTest() {
interface AssertDSL {
infix fun Any?.equals(other: Any?) = assertEquals(other, this)
infix fun Collection<Any>?.allEquals(other: Any?) =
- this?.onEach { it equals other } ?: run { assert(false) { "Collection is empty" } }
+ this?.onEach { it equals other } ?: run { fail("Collection is empty") }
infix fun <T> Collection<T>?.exists(e: T) {
assertTrue(this.orEmpty().isNotEmpty(), "Collection cannot be null or empty")
assertTrue(this!!.any{it == e}, "Collection doesn't contain $e")
@@ -36,7 +37,7 @@ interface AssertDSL {
infix fun <T> T?.notNull(name: String): T = this.assertNotNull(name)
fun <T> Collection<T>.assertCount(n: Int, prefix: String = "") =
- assert(count() == n) { "${prefix}Expected $n, got ${count()}" }
+ assertEquals(n, count(), "${prefix}Expected $n, got ${count()}")
}
/*