From b65512440c3722f72da01f9eafb23d4842c6b819 Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Sun, 8 Oct 2023 18:23:16 -0700 Subject: [PATCH] Rewrites SubscribePacketTest with matchers Issue #2745 --- .../pump/medtrum/comm/packets/SubscribePacketTest.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SubscribePacketTest.kt b/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SubscribePacketTest.kt index 341cc260c9..6753c17a6b 100644 --- a/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SubscribePacketTest.kt +++ b/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SubscribePacketTest.kt @@ -1,10 +1,10 @@ package info.nightscout.pump.medtrum.comm.packets +import com.google.common.truth.Truth.assertThat import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.medtrum.MedtrumTestBase import info.nightscout.pump.medtrum.extension.toByteArray -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test class SubscribePacketTest : MedtrumTestBase() { @@ -28,8 +28,7 @@ class SubscribePacketTest : MedtrumTestBase() { val result = packet.getRequest() // Expected values - val expectedByteArray = byteArrayOf(opCode.toByte()) + 4095.toByteArray(2) - Assertions.assertEquals(3, result.size) - Assertions.assertEquals(expectedByteArray.contentToString(), result.contentToString()) + val expected = byteArrayOf(opCode.toByte()) + 4095.toByteArray(2) + assertThat(result).asList().containsExactlyElementsIn(expected.toList()).inOrder() } }