Rewrites ClearPumpAlarmPacketTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-10-08 16:47:00 -07:00
parent b1a2d20646
commit 9cb7bed31a

View file

@ -1,10 +1,10 @@
package info.nightscout.pump.medtrum.comm.packets package info.nightscout.pump.medtrum.comm.packets
import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.pump.medtrum.MedtrumTestBase import info.nightscout.pump.medtrum.MedtrumTestBase
import info.nightscout.pump.medtrum.extension.toInt import info.nightscout.pump.medtrum.extension.toInt
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class ClearPumpAlarmPacketTest : MedtrumTestBase() { class ClearPumpAlarmPacketTest : MedtrumTestBase() {
@ -29,8 +29,8 @@ class ClearPumpAlarmPacketTest : MedtrumTestBase() {
val result = packet.getRequest() val result = packet.getRequest()
// Expected values // Expected values
Assertions.assertEquals(3, result.size) assertThat(result).hasLength(3)
Assertions.assertEquals(opCode.toByte(), result[0]) assertThat(result[0]).isEqualTo(opCode.toByte())
Assertions.assertEquals(clearCode, result.copyOfRange(1, 3).toInt()) assertThat(result.copyOfRange(1, 3).toInt()).isEqualTo(clearCode)
} }
} }