Rewrites ReadBolusStatePacketTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-10-08 17:38:25 -07:00
parent 7055ced8db
commit 59d81e47de

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 ReadBolusStatePacketTest : MedtrumTestBase() {
@ -31,9 +31,9 @@ class ReadBolusStatePacketTest : MedtrumTestBase() {
val result = packet.handleResponse(response)
// Expected values
Assertions.assertTrue(result)
Assertions.assertFalse(packet.failed)
Assertions.assertEquals(bolusData.contentToString(), packet.bolusData.contentToString())
assertThat(result).isTrue()
assertThat(packet.failed).isFalse()
assertThat(packet.bolusData).isEqualTo(bolusData)
}
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
@ -47,8 +47,8 @@ class ReadBolusStatePacketTest : MedtrumTestBase() {
val result = packet.handleResponse(response)
// Expected values
Assertions.assertEquals(false, result)
Assertions.assertEquals(true, packet.failed)
Assertions.assertEquals(byteArrayOf().contentToString(), packet.bolusData.contentToString())
assertThat(result).isFalse()
assertThat(packet.failed).isTrue()
assertThat(packet.bolusData).isEmpty()
}
}