parent
06b219aade
commit
23372a3167
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue