From 65b551936191ee8d9032318aad6c619dad1c4dfa Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Thu, 5 Oct 2023 22:54:57 -0700 Subject: [PATCH] Rewrites AapsErosPodStateManagerTest with matchers Issue #2745 --- .../manager/AapsErosPodStateManagerTest.kt | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt index 8880aa2ae6..a4a03a759e 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.manager import app.aaps.core.interfaces.sharedPreferences.SP import app.aaps.shared.tests.TestBase +import com.google.common.truth.Truth.assertThat import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FirmwareVersion import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus import org.joda.time.DateTime @@ -9,7 +10,6 @@ import org.joda.time.DateTimeUtils import org.joda.time.DateTimeZone import org.joda.time.Duration import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.mockito.Mock @@ -28,11 +28,10 @@ class AapsErosPodStateManagerTest : TestBase() { 0, 0, FirmwareVersion(1, 1, 1), FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS ) - Assertions.assertEquals(now, podStateManager.time) - Assertions.assertEquals( + assertThat(podStateManager.time).isEqualTo(now) + assertThat(podStateManager.scheduleOffset).isEqualTo( Duration.standardHours(1) - .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), - podStateManager.scheduleOffset + .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))) ) } @@ -52,11 +51,10 @@ class AapsErosPodStateManagerTest : TestBase() { // The system time zone has been updated, but the pod session state's time zone hasn't // So the pods time should not have been changed - Assertions.assertEquals(now, podStateManager.time) - Assertions.assertEquals( + assertThat(podStateManager.time).isEqualTo(now) + assertThat(podStateManager.scheduleOffset).isEqualTo( Duration.standardHours(1) - .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), - podStateManager.scheduleOffset + .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))) ) } @@ -77,15 +75,14 @@ class AapsErosPodStateManagerTest : TestBase() { // Both the system time zone have been updated // So the pods time should have been changed (to +2 hours) - Assertions.assertEquals(now.withZone(newTimeZone), podStateManager.time) - Assertions.assertEquals( + assertThat(podStateManager.time).isEqualTo(now.withZone(newTimeZone)) + assertThat(podStateManager.scheduleOffset).isEqualTo( Duration.standardHours(3) - .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), - podStateManager.scheduleOffset + .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))) ) } @AfterEach fun tearDown() { DateTimeUtils.setCurrentMillisSystem() } -} \ No newline at end of file +}