From 58dd9692de6a3cda80952b47cb997a31a9369ae3 Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Sun, 8 Oct 2023 18:17:44 -0700 Subject: [PATCH] Rewrites SetTimePacketTest with matchers Issue #2745 --- .../pump/medtrum/comm/packets/SetTimePacketTest.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SetTimePacketTest.kt b/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SetTimePacketTest.kt index 7d45db28dc..70abf87455 100644 --- a/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SetTimePacketTest.kt +++ b/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/SetTimePacketTest.kt @@ -1,11 +1,11 @@ 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 info.nightscout.pump.medtrum.util.MedtrumTimeUtil -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test class SetTimePacketTest : MedtrumTestBase() { @@ -30,8 +30,7 @@ class SetTimePacketTest : MedtrumTestBase() { val result = packet.getRequest() // Expected values - val expectedByteArray = byteArrayOf(opCode.toByte()) + 2.toByte() + time.toByteArray(4) - Assertions.assertEquals(6, result.size) - Assertions.assertEquals(expectedByteArray.contentToString(), result.contentToString()) + val expected = byteArrayOf(opCode.toByte()) + 2.toByte() + time.toByteArray(4) + assertThat(result).asList().containsExactlyElementsIn(expected.toList()).inOrder() } }