From 9f44f30f7d4ebd7c455b54733b2957b66bf05d1c Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Wed, 4 Oct 2023 22:16:26 -0700 Subject: [PATCH] Rewrites TriggerBTDeviceTest with matchers Issue #2745 --- .../automation/triggers/TriggerBTDeviceTest.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt index 91b912d9ef..c0a7cfd89a 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt @@ -3,8 +3,8 @@ package app.aaps.plugins.automation.triggers import app.aaps.plugins.automation.elements.ComparatorConnect import com.google.common.truth.Truth.assertThat import org.json.JSONObject -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test +import org.skyscreamer.jsonassert.JSONAssert class TriggerBTDeviceTest : TriggerTestBase() { @@ -19,14 +19,14 @@ class TriggerBTDeviceTest : TriggerTestBase() { @Test fun toJSON() { val t = TriggerBTDevice(injector) t.btDevice.value = someName - Assertions.assertEquals(btJson, t.toJSON()) + JSONAssert.assertEquals(btJson, t.toJSON(), true) } @Test fun fromJSON() { val t2 = TriggerDummy(injector).instantiate(JSONObject(btJson)) as TriggerBTDevice - Assertions.assertEquals(ComparatorConnect.Compare.ON_CONNECT, t2.comparator.value) - Assertions.assertEquals("Headset", t2.btDevice.value) + assertThat(t2.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_CONNECT) + assertThat(t2.btDevice.value).isEqualTo("Headset") } @Test @@ -40,7 +40,7 @@ class TriggerBTDeviceTest : TriggerTestBase() { it.btDevice.value = someName } val t1 = t.duplicate() as TriggerBTDevice - Assertions.assertEquals("Headset", t1.btDevice.value) - Assertions.assertEquals(ComparatorConnect.Compare.ON_DISCONNECT, t.comparator.value) + assertThat(t1.btDevice.value).isEqualTo("Headset") + assertThat(t.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_DISCONNECT) } -} \ No newline at end of file +}