Replaces assertTrue with truth matchers in DateUtilTest

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-06 21:04:44 -07:00
parent 6e03835b29
commit 6059a62b94

View file

@ -1,6 +1,7 @@
package info.nightscout.core.utils
import android.content.Context
import com.google.common.truth.Truth.assertThat
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
@ -40,7 +41,7 @@ class DateUtilTest : TestBase() {
}
@Test fun dateStringTest() {
Assertions.assertTrue(DateUtil(context).dateString(1513902750000L).contains("22"))
assertThat(DateUtil(context).dateString(1513902750000L)).contains("22")
}
@Test fun timeStringTest() {
@ -48,15 +49,15 @@ class DateUtilTest : TestBase() {
}
@Test fun dateAndTimeStringTest() {
Assertions.assertTrue(DateUtil(context).dateAndTimeString(1513902750000L).contains("22"))
Assertions.assertTrue(DateUtil(context).dateAndTimeString(1513902750000L).contains("32"))
assertThat(DateUtil(context).dateAndTimeString(1513902750000L)).contains("22")
assertThat(DateUtil(context).dateAndTimeString(1513902750000L)).contains("32")
}
@Test fun dateAndTimeRangeStringTest() {
Assertions.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("22"))
Assertions.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("32"))
Assertions.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("22"))
Assertions.assertTrue(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L).contains("32"))
assertThat(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L)).contains("22")
assertThat(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L)).contains("32")
assertThat(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L)).contains("22")
assertThat(DateUtil(context).dateAndTimeRangeString(1513902750000L, 1513902750000L)).contains("32")
}
/*
@ -69,4 +70,4 @@ class DateUtilTest : TestBase() {
`when`(rh.gs(info.nightscout.shared.R.string.shorthour)).thenReturn("h")
Assertions.assertEquals("(1h 1')", DateUtil(context).timeFrameString(T.hours(1).msecs() + T.mins(1).msecs(), rh))
}
}
}