Rewrites SilenceAlertsCommandTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-10-08 21:00:48 -07:00
parent 124e27b449
commit 1d3c697caa

View file

@ -1,15 +1,14 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command 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.AlertType import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertType
import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex import org.apache.commons.codec.binary.Hex
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import java.util.EnumSet import java.util.EnumSet
class SilenceAlertsCommandTest { class SilenceAlertsCommandTest {
@Test @Throws(DecoderException::class) fun testSilenceLowReservoirAlert() { @Test fun testSilenceLowReservoirAlert() {
val encoded = SilenceAlertsCommand.Builder() val encoded = SilenceAlertsCommand.Builder()
.setUniqueId(37879811) .setUniqueId(37879811)
.setSequenceNumber(1.toShort()) .setSequenceNumber(1.toShort())
@ -18,7 +17,7 @@ class SilenceAlertsCommandTest {
.build() .build()
.encoded .encoded
Assertions.assertArrayEquals(Hex.decodeHex("0242000304071105494E532E1081CE"), encoded) assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0242000304071105494E532E1081CE").asList()).inOrder()
} }
// TODO capture more silence alerts commands // TODO capture more silence alerts commands