Rewrites DanaRsPacketBasalGetBasalRateTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-08 19:42:39 -07:00
parent 5a19329889
commit 369c876d49

View file

@ -1,9 +1,9 @@
package info.nightscout.pump.danars.comm package info.nightscout.pump.danars.comm
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.danars.DanaRSTestBase import info.nightscout.pump.danars.DanaRSTestBase
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() { class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() {
@ -28,9 +28,9 @@ class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() {
putIntToArray(array, 0, (1.0 * 100).toInt()) putIntToArray(array, 0, (1.0 * 100).toInt())
putByteToArray(array, 2, (0.05 * 100).toInt().toByte()) putByteToArray(array, 2, (0.05 * 100).toInt().toByte())
packet.handleMessage(array) packet.handleMessage(array)
Assertions.assertEquals(1.0, danaPump.maxBasal, 0.0) assertThat(danaPump.maxBasal).isWithin(0.001).of(1.0)
Assertions.assertEquals(0.05, danaPump.basalStep, 0.0) assertThat(danaPump.basalStep).isWithin(0.001).of(0.05)
Assertions.assertTrue(packet.failed) assertThat(packet.failed).isTrue()
Assertions.assertEquals("BASAL__GET_BASAL_RATE", packet.friendlyName) assertThat(packet.friendlyName).isEqualTo("BASAL__GET_BASAL_RATE")
} }
} }