From 23372a31678c2038b5109292d6d44fec13fb9418 Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Wed, 4 Oct 2023 20:45:27 -0700 Subject: [PATCH] Rewrites InputBgTest with matchers Issue #2745 --- .../plugins/automation/elements/InputBgTest.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt index 7ac891bc13..49af000a2d 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.elements import app.aaps.core.interfaces.db.GlucoseUnit import app.aaps.plugins.automation.triggers.TriggerTestBase -import org.junit.jupiter.api.Assertions +import com.google.common.truth.Truth.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` @@ -12,16 +12,16 @@ class InputBgTest : TriggerTestBase() { @Test fun setValueTest() { var i: InputBg = InputBg(profileFunction).setUnits(GlucoseUnit.MMOL).setValue(5.0) - Assertions.assertEquals(5.0, i.value, 0.01) - Assertions.assertEquals(InputBg.MMOL_MIN, i.minValue, 0.01) + assertThat(i.value).isWithin(0.01).of(5.0) + assertThat(i.minValue).isWithin(0.01).of(InputBg.MMOL_MIN) i = InputBg(profileFunction).setValue(100.0).setUnits(GlucoseUnit.MGDL) - Assertions.assertEquals(100.0, i.value, 0.01) - Assertions.assertEquals(InputBg.MGDL_MIN, i.minValue, 0.01) - Assertions.assertEquals(GlucoseUnit.MGDL, i.units) + assertThat(i.value).isWithin(0.01).of(100.0) + assertThat(i.minValue).isWithin(0.01).of(InputBg.MGDL_MIN) + assertThat(i.units).isEqualTo(GlucoseUnit.MGDL) } @BeforeEach fun prepare() { `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) } -} \ No newline at end of file +}