From c63ea36637ce956029fb15b1482c0683ecb8a587 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Wed, 30 Aug 2023 15:58:46 +0200 Subject: Migrate to JUnit 5 and unify used test API (#3138) --- plugins/base/src/test/kotlin/utils/TestUtils.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'plugins/base/src/test/kotlin/utils') 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?.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 Collection?.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?.notNull(name: String): T = this.assertNotNull(name) fun Collection.assertCount(n: Int, prefix: String = "") = - assert(count() == n) { "${prefix}Expected $n, got ${count()}" } + assertEquals(n, count(), "${prefix}Expected $n, got ${count()}") } /* -- cgit