From ee77a6283058497e3903964a2bbc99f501db4ebe Mon Sep 17 00:00:00 2001 From: Colin White Date: Wed, 6 Dec 2023 18:23:56 -0500 Subject: [PATCH] Fix deprecated API usage. (#1732) --- .../kotlin/app/cash/redwood/ui/ModifierTest.kt | 14 +++++++------- .../cash/redwood/treehouse/TreehouseLayoutTest.kt | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/redwood-runtime/src/commonTest/kotlin/app/cash/redwood/ui/ModifierTest.kt b/redwood-runtime/src/commonTest/kotlin/app/cash/redwood/ui/ModifierTest.kt index c7697c76ee..786c8a3b81 100644 --- a/redwood-runtime/src/commonTest/kotlin/app/cash/redwood/ui/ModifierTest.kt +++ b/redwood-runtime/src/commonTest/kotlin/app/cash/redwood/ui/ModifierTest.kt @@ -19,7 +19,7 @@ import app.cash.redwood.Modifier import assertk.assertThat import assertk.assertions.hashCodeFun import assertk.assertions.isEqualTo -import assertk.assertions.isSameAs +import assertk.assertions.isSameInstanceAs import assertk.assertions.toStringFun import kotlin.test.Test import kotlin.test.fail @@ -35,7 +35,7 @@ class ModifierTest { val a = NamedModifier("A") var called = 0 a.forEach { element -> - assertThat(element).isSameAs(a) + assertThat(element).isSameInstanceAs(a) called++ } assertThat(called).isEqualTo(1) @@ -48,18 +48,18 @@ class ModifierTest { val expected = listOf(a, b, c) var called = 0 (a then b then c).forEach { element -> - assertThat(element).isSameAs(expected[called]) + assertThat(element).isSameInstanceAs(expected[called]) called++ } assertThat(called).isEqualTo(3) } @Test fun thenIgnoresUnitModifier() { - assertThat(Modifier then Modifier).isSameAs(Modifier) + assertThat(Modifier then Modifier).isSameInstanceAs(Modifier) val a = NamedModifier("A") - assertThat(a then Modifier).isSameAs(a) - assertThat(Modifier then a).isSameAs(a) + assertThat(a then Modifier).isSameInstanceAs(a) + assertThat(Modifier then a).isSameInstanceAs(a) } @Test fun thenElementsToElements() { @@ -70,7 +70,7 @@ class ModifierTest { val expected = listOf(a, b, c, d) var called = 0 ((a then b) then (c then d)).forEach { element -> - assertThat(element).isSameAs(expected[called]) + assertThat(element).isSameInstanceAs(expected[called]) called++ } assertThat(called).isEqualTo(4) diff --git a/redwood-treehouse-host/src/androidUnitTest/kotlin/app/cash/redwood/treehouse/TreehouseLayoutTest.kt b/redwood-treehouse-host/src/androidUnitTest/kotlin/app/cash/redwood/treehouse/TreehouseLayoutTest.kt index 32ce85112c..96ec0a3450 100644 --- a/redwood-treehouse-host/src/androidUnitTest/kotlin/app/cash/redwood/treehouse/TreehouseLayoutTest.kt +++ b/redwood-treehouse-host/src/androidUnitTest/kotlin/app/cash/redwood/treehouse/TreehouseLayoutTest.kt @@ -35,7 +35,7 @@ import app.cash.turbine.test import assertk.assertThat import assertk.assertions.hasSize import assertk.assertions.isEqualTo -import assertk.assertions.isSameAs +import assertk.assertions.isSameInstanceAs import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith @@ -54,7 +54,7 @@ class TreehouseLayoutTest { val view = View(activity) layout.children.insert(0, viewWidget(view)) assertThat(layout.childCount).isEqualTo(1) - assertThat(layout.getChildAt(0)).isSameAs(view) + assertThat(layout.getChildAt(0)).isSameInstanceAs(view) } @Test fun attachAndDetachSendsStateChange() {