fix tests
This commit is contained in:
parent
18f01d7b59
commit
de1694d1a3
2 changed files with 6 additions and 12 deletions
|
@ -38,9 +38,7 @@ import org.junit.jupiter.api.BeforeEach
|
|||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.anyLong
|
||||
import org.mockito.Mockito.verify
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.mockito.internal.verification.Times
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
internal class NSClientV3PluginTest : TestBaseWithProfile() {
|
||||
|
@ -70,7 +68,7 @@ internal class NSClientV3PluginTest : TestBaseWithProfile() {
|
|||
sut =
|
||||
NSClientV3Plugin(
|
||||
injector, aapsLogger, aapsSchedulers, rxBus, rh, context, fabricPrivacy,
|
||||
sp, receiverDelegate, config, dateUtil, uiInteraction, dataSyncSelectorV3, mockedProfileFunction, repository,
|
||||
sp, receiverDelegate, config, dateUtil, uiInteraction, dataSyncSelectorV3, repository,
|
||||
nsDeviceStatusHandler, nsClientSource, nsIncomingDataProcessor, storeDataForDb
|
||||
)
|
||||
sut.nsAndroidClient = nsAndroidClient
|
||||
|
@ -361,11 +359,11 @@ internal class NSClientV3PluginTest : TestBaseWithProfile() {
|
|||
val dataPair = DataSyncSelector.PairExtendedBolus(extendedBolus, 1000)
|
||||
// create
|
||||
`when`(nsAndroidClient.createTreatment(anyObject())).thenReturn(CreateUpdateResponse(201, "aaa"))
|
||||
sut.nsAdd("treatments", dataPair, "1/3")
|
||||
sut.nsAdd("treatments", dataPair, "1/3", validProfile)
|
||||
Assertions.assertEquals(1, storeDataForDb.nsIdExtendedBoluses.size)
|
||||
// update
|
||||
`when`(nsAndroidClient.updateTreatment(anyObject())).thenReturn(CreateUpdateResponse(200, "aaa"))
|
||||
sut.nsUpdate("treatments", dataPair, "1/3")
|
||||
sut.nsUpdate("treatments", dataPair, "1/3", validProfile)
|
||||
Assertions.assertEquals(2, storeDataForDb.nsIdExtendedBoluses.size)
|
||||
}
|
||||
|
||||
|
@ -415,11 +413,11 @@ internal class NSClientV3PluginTest : TestBaseWithProfile() {
|
|||
val dataPair = DataSyncSelector.PairTemporaryBasal(temporaryBasal, 1000)
|
||||
// create
|
||||
`when`(nsAndroidClient.createTreatment(anyObject())).thenReturn(CreateUpdateResponse(201, "aaa"))
|
||||
sut.nsAdd("treatments", dataPair, "1/3")
|
||||
sut.nsAdd("treatments", dataPair, "1/3", validProfile)
|
||||
Assertions.assertEquals(1, storeDataForDb.nsIdTemporaryBasals.size)
|
||||
// update
|
||||
`when`(nsAndroidClient.updateTreatment(anyObject())).thenReturn(CreateUpdateResponse(200, "aaa"))
|
||||
sut.nsUpdate("treatments", dataPair, "1/3")
|
||||
sut.nsUpdate("treatments", dataPair, "1/3", validProfile)
|
||||
Assertions.assertEquals(2, storeDataForDb.nsIdTemporaryBasals.size)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import info.nightscout.database.entities.embedments.InterfaceIDs
|
|||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.nsclient.StoreDataForDb
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
import info.nightscout.interfaces.receivers.ReceiverStatusStore
|
||||
import info.nightscout.interfaces.source.NSClientSource
|
||||
import info.nightscout.interfaces.sync.DataSyncSelectorV3
|
||||
|
@ -31,7 +30,6 @@ import info.nightscout.sdk.remotemodel.LastModified
|
|||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
|
@ -43,7 +41,6 @@ import org.mockito.ArgumentMatchers.anyString
|
|||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
internal class LoadBgWorkerTest : TestBase() {
|
||||
|
||||
@Mock lateinit var sp: SP
|
||||
|
@ -51,7 +48,6 @@ internal class LoadBgWorkerTest : TestBase() {
|
|||
@Mock lateinit var dateUtil: DateUtil
|
||||
@Mock lateinit var nsAndroidClient: NSAndroidClient
|
||||
@Mock lateinit var rh: ResourceHelper
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var config: Config
|
||||
@Mock lateinit var uiInteraction: UiInteraction
|
||||
@Mock lateinit var dataSyncSelectorV3: DataSyncSelectorV3
|
||||
|
@ -98,7 +94,7 @@ internal class LoadBgWorkerTest : TestBase() {
|
|||
receiverDelegate = ReceiverDelegate(rxBus, rh, sp, receiverStatusStore, aapsSchedulers, fabricPrivacy)
|
||||
nsClientV3Plugin = NSClientV3Plugin(
|
||||
injector, aapsLogger, aapsSchedulers, rxBus, rh, context, fabricPrivacy,
|
||||
sp, receiverDelegate, config, dateUtil, uiInteraction, dataSyncSelectorV3, profileFunction, repository,
|
||||
sp, receiverDelegate, config, dateUtil, uiInteraction, dataSyncSelectorV3, repository,
|
||||
nsDeviceStatusHandler, nsClientSource, nsIncomingDataProcessor, storeDataForDb
|
||||
)
|
||||
nsClientV3Plugin.newestDataOnServer = LastModified(LastModified.Collections())
|
||||
|
|
Loading…
Reference in a new issue