From 6059a62b944b88b51cd840581d5995f22e9c0e2f Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Wed, 6 Sep 2023 21:04:44 -0700 Subject: [PATCH] Replaces assertTrue with truth matchers in DateUtilTest Issue #2745 --- .../info/nightscout/core/utils/DateUtilTest.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/core/main/src/test/java/info/nightscout/core/utils/DateUtilTest.kt b/core/main/src/test/java/info/nightscout/core/utils/DateUtilTest.kt index 7dc59fdb5e..6f89532ac1 100644 --- a/core/main/src/test/java/info/nightscout/core/utils/DateUtilTest.kt +++ b/core/main/src/test/java/info/nightscout/core/utils/DateUtilTest.kt @@ -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)) } -} \ No newline at end of file +}