diff --git a/buildSrc/src/main/kotlin/com/ouroboros/dependencies.kt b/buildSrc/src/main/kotlin/com/ouroboros/dependencies.kt index 109a479..415a56e 100644 --- a/buildSrc/src/main/kotlin/com/ouroboros/dependencies.kt +++ b/buildSrc/src/main/kotlin/com/ouroboros/dependencies.kt @@ -10,6 +10,7 @@ object Libs { object Kotlin { private const val version = "1.9.22" const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version" + const val testJUnit = "org.jetbrains.kotlin:kotlin-test-junit:$version" } object Coroutines { diff --git a/test/build.gradle b/test/build.gradle index b7d45ac..80e6733 100644 --- a/test/build.gradle +++ b/test/build.gradle @@ -45,9 +45,8 @@ android { dependencies { api project(':core') - implementation (Libs.Kotest.assertions){ - exclude group: 'org.jetbrains.kotlin' - } + implementation(Libs.junit) + implementation(Libs.Kotlin.testJUnit) } afterEvaluate { diff --git a/test/src/main/kotlin/com/bridge/ouroboros/compose/test/EffectMatching.kt b/test/src/main/kotlin/com/bridge/ouroboros/compose/test/EffectMatching.kt index 0f48b45..e6ddddd 100644 --- a/test/src/main/kotlin/com/bridge/ouroboros/compose/test/EffectMatching.kt +++ b/test/src/main/kotlin/com/bridge/ouroboros/compose/test/EffectMatching.kt @@ -1,10 +1,7 @@ package com.bridge.ouroboros.compose.test -import io.kotest.assertions.withClue -import io.kotest.matchers.Matcher -import io.kotest.matchers.MatcherResult -import io.kotest.matchers.collections.shouldBeEmpty -import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder +import kotlin.test.junit.JUnitAsserter.assertEquals +import kotlin.test.junit.JUnitAsserter.assertTrue class EffectMatching( capturedEvents: Set @@ -18,15 +15,11 @@ class EffectMatching( } fun expectEvents(vararg events: E) { - withClue("Expected events to be $events") { - emittedEvents shouldContainExactlyInAnyOrder events.toSet() - } + assertEquals("Expected events to be $events", events.toSet(), emittedEvents) } fun expectNoEvents() { - withClue("Expected events to be empty") { - emittedEvents.shouldBeEmpty() - } + assertTrue("Expected events to be empty", emittedEvents.isEmpty()) } operator fun invoke(block: EffectMatching.() -> Unit) { @@ -40,11 +33,3 @@ class EffectMatching( } } } - -fun haveNoEvents() = object : Matcher> { - override fun test(value: EffectResult) = MatcherResult( - value.events.isEmpty(), - { "Effect should not have emitted any events but were ${value.events}" }, - { "Effect should have emitted at least one event but no events were sent" } - ) -} \ No newline at end of file diff --git a/test/src/main/kotlin/com/bridge/ouroboros/compose/test/NextMatching.kt b/test/src/main/kotlin/com/bridge/ouroboros/compose/test/NextMatching.kt index f8cb615..967dce8 100644 --- a/test/src/main/kotlin/com/bridge/ouroboros/compose/test/NextMatching.kt +++ b/test/src/main/kotlin/com/bridge/ouroboros/compose/test/NextMatching.kt @@ -1,10 +1,9 @@ package com.bridge.ouroboros.compose.test import com.bridge.ouroboros.compose.Next -import io.kotest.assertions.withClue -import io.kotest.matchers.collections.shouldBeEmpty -import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder -import io.kotest.matchers.shouldBe +import kotlin.test.junit.JUnitAsserter.assertEquals +import kotlin.test.junit.JUnitAsserter.assertNull +import kotlin.test.junit.JUnitAsserter.assertTrue class NextMatching(private val next: Next) { @@ -30,15 +29,11 @@ class NextMatching(private val next: Next) { } fun shouldHaveModel(model: M) { - withClue("Expect new model to be $model") { - newModel shouldBe model - } + assertEquals("Expect new model to be $model", model, newModel) } fun shouldNotHaveModel() { - withClue("Expected no new model") { - newModel shouldBe null - } + assertNull("Expected no new model", newModel) } fun shouldHaveEffects(vararg effects: F) { @@ -46,9 +41,7 @@ class NextMatching(private val next: Next) { } infix fun Set.shouldEmit(effects: Set) { - withClue("Expecting effects to be $effects") { - newEffects shouldContainExactlyInAnyOrder effects - } + assertEquals("Expecting effects to be $effects", effects, newEffects) } infix fun Set.shouldEmit(effect: F) { @@ -56,9 +49,7 @@ class NextMatching(private val next: Next) { } fun shouldNotHaveEffects() { - withClue("No effects should be emitted") { - newEffects.shouldBeEmpty() - } + assertTrue("No effects should be emitted", newEffects.isEmpty()) } fun shouldNotChange() {