From 102cac6fa8ec6ff12f78051101446072482b8f67 Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Thu, 5 Oct 2023 22:38:28 -0700 Subject: [PATCH] Rewrites RFSpyTest with matchers Issue #2745 --- .../pump/common/hw/rileylink/ble/RFSpyTest.kt | 114 ++++-------------- 1 file changed, 24 insertions(+), 90 deletions(-) diff --git a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt index 85ecd40eda..428e10281c 100644 --- a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt +++ b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt @@ -1,100 +1,34 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble import app.aaps.shared.tests.TestBase +import com.google.common.truth.Truth.assertThat import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @Suppress("SpellCheckingInspection") class RFSpyTest : TestBase() { @Test fun testGetFirmwareVersion() { - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_1_0, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_1_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_1_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_0, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_0, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_2, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_2, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_2, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_2_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_3_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_3_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_3_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_3_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_4_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_4_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_4_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.Version_4_x, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.UnknownVersion, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.UnknownVersion, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0") - ) - Assertions.assertEquals( - RileyLinkFirmwareVersion.UnknownVersion, - RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5") - ) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0")).isEqualTo(RileyLinkFirmwareVersion.Version_1_0) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1")).isEqualTo(RileyLinkFirmwareVersion.Version_1_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13")).isEqualTo(RileyLinkFirmwareVersion.Version_1_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0")).isEqualTo(RileyLinkFirmwareVersion.Version_2_0) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1")).isEqualTo(RileyLinkFirmwareVersion.Version_2_0) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion) + assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion) } -} \ No newline at end of file +}