From 89366e54b8fadb007eae879abe8a1da1e4c69481 Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Thu, 5 Oct 2023 22:57:53 -0700 Subject: [PATCH] Rewrites AapsOmnipodErosManagerTest with matchers Issue #2745 --- .../AapsOmnipodErosManagerTest.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt index 319949317b..5cd712ad0f 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt @@ -2,9 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import app.aaps.core.interfaces.profile.Profile import app.aaps.core.interfaces.profile.Profile.ProfileValue +import com.google.common.truth.Truth.assertThat import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager import org.joda.time.Duration -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.mockito.Mockito import kotlin.test.assertFailsWith @@ -22,16 +22,16 @@ internal class AapsOmnipodErosManagerTest { ) val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile) val entries = basalSchedule.entries - Assertions.assertEquals(3, entries.size) + assertThat(entries).hasSize(3) val entry1 = entries[0] - Assertions.assertEquals(Duration.standardSeconds(0), entry1.startTime) - Assertions.assertEquals(0.5, entry1.rate, 0.000001) + assertThat(entry1.startTime).isEqualTo(Duration.standardSeconds(0)) + assertThat(entry1.rate).isWithin(0.000001).of(0.5) val entry2 = entries[1] - Assertions.assertEquals(Duration.standardSeconds(18000), entry2.startTime) - Assertions.assertEquals(1.0, entry2.rate, 0.000001) + assertThat(entry2.startTime).isEqualTo(Duration.standardSeconds(18000)) + assertThat(entry2.rate).isWithin(0.000001).of(1.0) val entry3 = entries[2] - Assertions.assertEquals(Duration.standardSeconds(50400), entry3.startTime) - Assertions.assertEquals(3.05, entry3.rate, 0.000001) + assertThat(entry3.startTime).isEqualTo(Duration.standardSeconds(50400)) + assertThat(entry3.rate).isWithin(0.000001).of(3.05) } @Test fun invalidProfileNullProfile() { @@ -90,6 +90,6 @@ internal class AapsOmnipodErosManagerTest { ) val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile) val basalScheduleEntry = basalSchedule.entries[0] - Assertions.assertEquals(0.05, basalScheduleEntry.rate, 0.000001) + assertThat(basalScheduleEntry.rate).isWithin(0.000001).of(0.05) } }