diff --git a/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/CancelTempBasalPacketTest.kt b/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/CancelTempBasalPacketTest.kt index ee4f252f65..8c151959bf 100644 --- a/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/CancelTempBasalPacketTest.kt +++ b/pump/medtrum/src/test/java/info/nightscout/pump/medtrum/comm/packets/CancelTempBasalPacketTest.kt @@ -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.comm.enums.BasalType -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test class CancelTempBasalPacketTest : MedtrumTestBase() { @@ -30,8 +30,7 @@ class CancelTempBasalPacketTest : MedtrumTestBase() { val result = packet.getRequest() // Expected values - Assertions.assertEquals(1, result.size) - Assertions.assertEquals(opCode.toByte(), result[0]) + assertThat(result).asList().containsExactly(opCode.toByte()) } @Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() { @@ -49,12 +48,12 @@ class CancelTempBasalPacketTest : MedtrumTestBase() { val expectedStartTime = 1679575392000L val expectedPatchId = 146L - Assertions.assertTrue(result) - Assertions.assertEquals(expectedBasalType, medtrumPump.lastBasalType) - Assertions.assertEquals(expectedBasalRate, medtrumPump.lastBasalRate, 0.01) - Assertions.assertEquals(expectedBasalSequence, medtrumPump.lastBasalSequence) - Assertions.assertEquals(expectedStartTime, medtrumPump.lastBasalStartTime) - Assertions.assertEquals(expectedPatchId, medtrumPump.lastBasalPatchId) + assertThat(result).isTrue() + assertThat(medtrumPump.lastBasalType).isEqualTo(expectedBasalType) + assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(expectedBasalRate) + assertThat(medtrumPump.lastBasalSequence).isEqualTo(expectedBasalSequence) + assertThat(medtrumPump.lastBasalStartTime).isEqualTo(expectedStartTime) + assertThat(medtrumPump.lastBasalPatchId).isEqualTo(expectedPatchId) } @Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() { @@ -66,7 +65,7 @@ class CancelTempBasalPacketTest : MedtrumTestBase() { val result = packet.handleResponse(response) // Expected values - Assertions.assertFalse(result) - Assertions.assertTrue(packet.failed) + assertThat(result).isFalse() + assertThat(packet.failed).isTrue() } }