parent
df233bbb81
commit
65b5519361
1 changed files with 11 additions and 14 deletions
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.manager
|
||||||
|
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.shared.tests.TestBase
|
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.FirmwareVersion
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
@ -9,7 +10,6 @@ import org.joda.time.DateTimeUtils
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import org.joda.time.Duration
|
import org.joda.time.Duration
|
||||||
import org.junit.jupiter.api.AfterEach
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
|
||||||
|
@ -28,11 +28,10 @@ class AapsErosPodStateManagerTest : TestBase() {
|
||||||
0, 0, FirmwareVersion(1, 1, 1),
|
0, 0, FirmwareVersion(1, 1, 1),
|
||||||
FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS
|
FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(now, podStateManager.time)
|
assertThat(podStateManager.time).isEqualTo(now)
|
||||||
Assertions.assertEquals(
|
assertThat(podStateManager.scheduleOffset).isEqualTo(
|
||||||
Duration.standardHours(1)
|
Duration.standardHours(1)
|
||||||
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
|
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
|
||||||
podStateManager.scheduleOffset
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,11 +51,10 @@ class AapsErosPodStateManagerTest : TestBase() {
|
||||||
|
|
||||||
// The system time zone has been updated, but the pod session state's time zone hasn't
|
// 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
|
// So the pods time should not have been changed
|
||||||
Assertions.assertEquals(now, podStateManager.time)
|
assertThat(podStateManager.time).isEqualTo(now)
|
||||||
Assertions.assertEquals(
|
assertThat(podStateManager.scheduleOffset).isEqualTo(
|
||||||
Duration.standardHours(1)
|
Duration.standardHours(1)
|
||||||
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
|
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
|
||||||
podStateManager.scheduleOffset
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,15 +75,14 @@ class AapsErosPodStateManagerTest : TestBase() {
|
||||||
|
|
||||||
// Both the system time zone have been updated
|
// Both the system time zone have been updated
|
||||||
// So the pods time should have been changed (to +2 hours)
|
// So the pods time should have been changed (to +2 hours)
|
||||||
Assertions.assertEquals(now.withZone(newTimeZone), podStateManager.time)
|
assertThat(podStateManager.time).isEqualTo(now.withZone(newTimeZone))
|
||||||
Assertions.assertEquals(
|
assertThat(podStateManager.scheduleOffset).isEqualTo(
|
||||||
Duration.standardHours(3)
|
Duration.standardHours(3)
|
||||||
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
|
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
|
||||||
podStateManager.scheduleOffset
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach fun tearDown() {
|
@AfterEach fun tearDown() {
|
||||||
DateTimeUtils.setCurrentMillisSystem()
|
DateTimeUtils.setCurrentMillisSystem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue