From f111f7f0918ba987bd9c12cd0f4ebbf040786c22 Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Sun, 8 Oct 2023 20:49:30 -0700 Subject: [PATCH] Rewrites ProgramAlertsCommandTest with matchers Issue #2745 --- .../pod/command/ProgramAlertsCommandTest.kt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt index 2497e8c74b..c77469c636 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt @@ -1,18 +1,17 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command +import com.google.common.truth.Truth.assertThat import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertConfiguration import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertTrigger import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertType import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepRepetitionType import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType -import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test class ProgramAlertsCommandTest { - @Test @Throws(DecoderException::class) fun testExpirationAlerts() { + @Test fun testExpirationAlerts() { val configurations: MutableList = ArrayList() configurations.add( AlertConfiguration( @@ -46,10 +45,10 @@ class ProgramAlertsCommandTest { .build() .encoded - Assertions.assertArrayEquals(Hex.decodeHex("024200038C121910494E532E79A410D1050228001275060280F5"), encoded) + assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200038C121910494E532E79A410D1050228001275060280F5").asList()).inOrder() } - @Test @Throws(DecoderException::class) fun testLowReservoirAlert() { + @Test fun testLowReservoirAlert() { val configurations: MutableList = ArrayList() configurations.add( AlertConfiguration( @@ -71,10 +70,10 @@ class ProgramAlertsCommandTest { .build() .encoded - Assertions.assertArrayEquals(Hex.decodeHex("02420003200C190A494E532E4C0000C801020149"), encoded) + assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("02420003200C190A494E532E4C0000C801020149").asList()).inOrder() } - @Test @Throws(DecoderException::class) fun testUserExpirationAlert() { + @Test fun testUserExpirationAlert() { val configurations: MutableList = ArrayList() configurations.add( AlertConfiguration( @@ -96,10 +95,10 @@ class ProgramAlertsCommandTest { .build() .encoded - Assertions.assertArrayEquals(Hex.decodeHex("024200033C0C190A494E532E38000FEF030203E2"), encoded) + assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200033C0C190A494E532E38000FEF030203E2").asList()).inOrder() } - @Test @Throws(DecoderException::class) fun testLumpOfCoalAlert() { + @Test fun testLumpOfCoalAlert() { val configurations: MutableList = ArrayList() configurations.add( AlertConfiguration( @@ -122,6 +121,6 @@ class ProgramAlertsCommandTest { .build() .encoded - Assertions.assertArrayEquals(Hex.decodeHex("02420003280C190A494E532E7837000508020356"), encoded) + assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("02420003280C190A494E532E7837000508020356").asList()).inOrder() } }