diff --git a/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt b/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt index 6e1d653d2d..a0444dadf0 100644 --- a/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/profile/ProfileStoreTest.kt @@ -3,6 +3,7 @@ package info.nightscout.implementation.profile import app.aaps.core.interfaces.profile.PureProfile import app.aaps.shared.tests.TestBaseWithProfile import com.google.common.truth.Truth.assertThat +import kotlin.test.assertIs import org.junit.jupiter.api.Test internal class ProfileStoreTest : TestBaseWithProfile() { @@ -14,7 +15,7 @@ internal class ProfileStoreTest : TestBaseWithProfile() { @Test fun getDefaultProfileTest() { - assertThat(getValidProfileStore().getDefaultProfile()).isInstanceOf(PureProfile::class.java) + assertIs(getValidProfileStore().getDefaultProfile()) } @Test @@ -35,7 +36,7 @@ internal class ProfileStoreTest : TestBaseWithProfile() { @Test fun getSpecificProfileTest() { - assertThat(getValidProfileStore().getSpecificProfile(TESTPROFILENAME)).isInstanceOf(PureProfile::class.java) + assertIs(getValidProfileStore().getSpecificProfile(TESTPROFILENAME)) } @Test diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt index df5b1a7e51..56bba2f6c7 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt @@ -1,6 +1,7 @@ package info.nightscout.automation.triggers import com.google.common.truth.Truth.assertThat +import kotlin.test.assertIs import org.json.JSONException import org.json.JSONObject import org.junit.jupiter.api.Test @@ -73,7 +74,7 @@ class TriggerConnectorTest : TriggerTestBase() { t.list.add(TriggerConnector(injector)) val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerConnector assertThat(t2.size()).isEqualTo(1) - assertThat(t2.list[0]).isInstanceOf(TriggerConnector::class.java) + assertIs(t2.list[0]) } } diff --git a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtensionKtTest.kt b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtensionKtTest.kt index 1aba0a9694..eed855f93f 100644 --- a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtensionKtTest.kt +++ b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtensionKtTest.kt @@ -1,12 +1,13 @@ package info.nightscout.plugins.sync.nsclientV3.extensions +import app.aaps.core.nssdk.localmodel.treatment.NSExtendedBolus +import app.aaps.core.nssdk.localmodel.treatment.NSTemporaryBasal +import app.aaps.core.nssdk.mapper.convertToRemoteAndBack import app.aaps.shared.tests.TestBaseWithProfile import com.google.common.truth.Truth.assertThat import info.nightscout.database.entities.ExtendedBolus import info.nightscout.database.entities.embedments.InterfaceIDs -import app.aaps.core.nssdk.localmodel.treatment.NSExtendedBolus -import app.aaps.core.nssdk.localmodel.treatment.NSTemporaryBasal -import app.aaps.core.nssdk.mapper.convertToRemoteAndBack +import kotlin.test.assertIs import org.junit.jupiter.api.Test @Suppress("SpellCheckingInspection") @@ -47,10 +48,10 @@ internal class ExtendedBolusExtensionKtTest : TestBaseWithProfile() { ) val converted = extendedBolus.toNSExtendedBolus(validProfile) - assertThat(converted).isInstanceOf(NSTemporaryBasal::class.java) + assertIs(converted) assertThat((converted as NSTemporaryBasal).extendedEmulated).isNotNull() val convertedBack = converted.convertToRemoteAndBack() - assertThat(convertedBack).isInstanceOf(NSExtendedBolus::class.java) + assertIs(convertedBack) extendedBolus2 = (extendedBolus.toNSExtendedBolus(validProfile).convertToRemoteAndBack() as NSExtendedBolus).toExtendedBolus() assertThat(extendedBolus.contentEqualsTo(extendedBolus2)).isTrue() diff --git a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/DataSyncWorkerTest.kt b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/DataSyncWorkerTest.kt index 6cb2b721db..a5d92f7cd7 100644 --- a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/DataSyncWorkerTest.kt +++ b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/DataSyncWorkerTest.kt @@ -12,6 +12,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.plugins.sync.nsclientV3.DataSyncSelectorV3 import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin +import kotlin.test.assertIs import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.BeforeEach @@ -64,6 +65,6 @@ internal class DataSyncWorkerTest : TestBase() { `when`(nsClient.hasWritePermission).thenReturn(true) val result = sut.doWorkAndLog() Mockito.verify(dataSyncSelectorV3, Mockito.times(1)).doUpload() - assertThat(result).isInstanceOf(Success::class.java) + assertIs(result) } } diff --git a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt index e536dba43f..7518bbd22a 100644 --- a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt +++ b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclientV3/workers/LoadBgWorkerTest.kt @@ -6,7 +6,6 @@ import androidx.work.OneTimeWorkRequest import androidx.work.WorkContinuation import androidx.work.WorkManager import androidx.work.testing.TestListenableWorkerBuilder -import app.aaps.core.main.utils.fabric.FabricPrivacy import app.aaps.core.interfaces.configuration.Config import app.aaps.core.interfaces.nsclient.StoreDataForDb import app.aaps.core.interfaces.receivers.ReceiverStatusStore @@ -16,6 +15,9 @@ import app.aaps.core.interfaces.source.NSClientSource import app.aaps.core.interfaces.ui.UiInteraction import app.aaps.core.interfaces.utils.DateUtil import app.aaps.core.interfaces.utils.DecimalFormatter +import app.aaps.core.main.utils.fabric.FabricPrivacy +import app.aaps.core.nssdk.interfaces.NSAndroidClient +import app.aaps.core.nssdk.remotemodel.LastModified import app.aaps.shared.tests.TestBase import com.google.common.truth.Truth.assertThat import dagger.android.AndroidInjector @@ -31,8 +33,7 @@ import info.nightscout.plugins.sync.nsclient.data.NSDeviceStatusHandler import info.nightscout.plugins.sync.nsclientV3.DataSyncSelectorV3 import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin import info.nightscout.plugins.sync.nsclientV3.extensions.toNSSvgV3 -import app.aaps.core.nssdk.interfaces.NSAndroidClient -import app.aaps.core.nssdk.remotemodel.LastModified +import kotlin.test.assertIs import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -111,7 +112,7 @@ internal class LoadBgWorkerTest : TestBase() { sut = TestListenableWorkerBuilder(context).build() val result = sut.doWorkAndLog() - assertThat(result).isInstanceOf(ListenableWorker.Result.Failure::class.java) + assertIs(result) } @Test @@ -121,7 +122,7 @@ internal class LoadBgWorkerTest : TestBase() { Mockito.`when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_cgm, false)).thenReturn(false) val result = sut.doWorkAndLog() - assertThat(result).isInstanceOf(ListenableWorker.Result.Success::class.java) + assertIs(result) assertThat(result.outputData.getString("Result")).isEqualTo("Load not enabled") } @@ -137,7 +138,7 @@ internal class LoadBgWorkerTest : TestBase() { val result = sut.doWorkAndLog() assertThat(nsClientV3Plugin.lastLoadedSrvModified.collections.entries).isEqualTo(now - 1000) - assertThat(result).isInstanceOf(ListenableWorker.Result.Success::class.java) + assertIs(result) } @Test @@ -165,7 +166,7 @@ internal class LoadBgWorkerTest : TestBase() { Mockito.`when`(nsAndroidClient.getSgvsNewerThan(anyLong(), anyInt())).thenReturn(NSAndroidClient.ReadResponse(200, 0, listOf(glucoseValue.toNSSvgV3()))) val result = sut.doWorkAndLog() - assertThat(result).isInstanceOf(ListenableWorker.Result.Success::class.java) + assertIs(result) } @Test @@ -180,6 +181,6 @@ internal class LoadBgWorkerTest : TestBase() { val result = sut.doWorkAndLog() assertThat(nsClientV3Plugin.lastLoadedSrvModified.collections.entries).isEqualTo(now - 1000) - assertThat(result).isInstanceOf(ListenableWorker.Result.Success::class.java) + assertIs(result) } }