Rewrites TherapyEventExtensionKtTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-23 18:42:34 -07:00
parent 439d61f849
commit b64a5d4715

View file

@ -1,10 +1,10 @@
package info.nightscout.core.extensions package info.nightscout.core.extensions
import app.aaps.shared.tests.TestBaseWithProfile import app.aaps.shared.tests.TestBaseWithProfile
import com.google.common.truth.Truth.assertThat
import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.TherapyEvent
import info.nightscout.database.entities.embedments.InterfaceIDs import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.shared.utils.T import info.nightscout.shared.utils.T
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.mockito.Mockito import org.mockito.Mockito
@ -30,8 +30,8 @@ class TherapyEventExtensionKtTest : TestBaseWithProfile() {
) )
) )
Mockito.`when`(dateUtil.now()).thenReturn(now + T.mins(30).msecs()) Mockito.`when`(dateUtil.now()).thenReturn(now + T.mins(30).msecs())
Assertions.assertFalse(therapyEvent.isOlderThan(1.0, dateUtil)) assertThat(therapyEvent.isOlderThan(1.0, dateUtil)).isFalse()
Mockito.`when`(dateUtil.now()).thenReturn(now + T.hours(2).msecs()) Mockito.`when`(dateUtil.now()).thenReturn(now + T.hours(2).msecs())
Assertions.assertTrue(therapyEvent.isOlderThan(1.0, dateUtil)) assertThat(therapyEvent.isOlderThan(1.0, dateUtil)).isTrue()
} }
} }