Rewrites SubscribePacketTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-10-08 18:23:16 -07:00
parent d24d97cc4b
commit b65512440c

View file

@ -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()
}
}