Rewrites InsulinOrefUltraRapidActingPluginTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-23 17:12:23 -07:00
parent 5acec0b363
commit 672aebb87c

View file

@ -1,5 +1,6 @@
package info.nightscout.insulin package info.nightscout.insulin
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.interfaces.Config import info.nightscout.interfaces.Config
@ -10,7 +11,6 @@ import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.ExtendWith
@ -47,24 +47,24 @@ class InsulinOrefUltraRapidActingPluginTest {
@Test @Test
fun `simple peak test`() { fun `simple peak test`() {
Assertions.assertEquals(55, sut.peak) assertThat(sut.peak).isEqualTo(55)
} }
@Test @Test
fun getIdTest() { fun getIdTest() {
Assertions.assertEquals(Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING, sut.id) assertThat(sut.id).isEqualTo(Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING)
} }
@Test @Test
fun commentStandardTextTest() { fun commentStandardTextTest() {
`when`(rh.gs(eq(R.string.ultra_fast_acting_insulin_comment))).thenReturn("Fiasp") `when`(rh.gs(eq(R.string.ultra_fast_acting_insulin_comment))).thenReturn("Fiasp")
Assertions.assertEquals("Fiasp", sut.commentStandardText()) assertThat(sut.commentStandardText()).isEqualTo("Fiasp")
} }
@Test @Test
fun getFriendlyNameTest() { fun getFriendlyNameTest() {
`when`(rh.gs(eq(R.string.ultra_rapid_oref))).thenReturn("Ultra-Rapid Oref") `when`(rh.gs(eq(R.string.ultra_rapid_oref))).thenReturn("Ultra-Rapid Oref")
Assertions.assertEquals("Ultra-Rapid Oref", sut.friendlyName) assertThat(sut.friendlyName).isEqualTo("Ultra-Rapid Oref")
} }
} }