fix tests

This commit is contained in:
Milos Kozak 2022-11-24 11:39:23 +01:00
parent 80f6050d04
commit c7c63f8403
3 changed files with 10 additions and 7 deletions

View file

@ -6,7 +6,6 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.extensions.pureProfileFromJson
import info.nightscout.core.profile.ProfileSealed
import info.nightscout.core.profile.ProfileStoreObject
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.DefaultValueHelper
@ -34,7 +33,6 @@ open class TestBaseWithProfile : TestBase() {
@Mock lateinit var config: Config
@Mock lateinit var sp: SP
@Mock lateinit var context: Context
@Mock lateinit var repository: AppRepository
private lateinit var hardLimits: HardLimits
lateinit var testPumpPlugin: TestPumpPlugin

View file

@ -21,6 +21,7 @@ import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.db.PersistenceLayer
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.pump.DetailedBolusInfo
@ -56,6 +57,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
@Mock lateinit var repository: AppRepository
@Mock lateinit var activityNames: ActivityNames
@Mock lateinit var androidPermission: AndroidPermission
@Mock lateinit var persistenceLayer: PersistenceLayer
class CommandQueueMocked(
injector: HasAndroidInjector,
@ -73,11 +75,12 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
repository: AppRepository,
fabricPrivacy: FabricPrivacy,
androidPermission: AndroidPermission,
activityNames: ActivityNames
activityNames: ActivityNames,
persistenceLayer: PersistenceLayer
) : CommandQueueImplementation(
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction,
activePlugin, context, sp, config, dateUtil, repository, fabricPrivacy,
androidPermission, activityNames
androidPermission, activityNames, persistenceLayer
) {
override fun notifyAboutNewCommand() : Boolean = true
@ -121,7 +124,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
injector, aapsLogger, rxBus, aapsSchedulers, rh,
constraintChecker, profileFunction, activePlugin, context, sp,
config, dateUtil, repository,
fabricPrivacy, androidPermission, activityNames
fabricPrivacy, androidPermission, activityNames, persistenceLayer
)
testPumpPlugin = TestPumpPlugin(injector)
@ -158,7 +161,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
val commandQueue = CommandQueueImplementation(
injector, aapsLogger, rxBus, aapsSchedulers, rh,
constraintChecker, profileFunction, activePlugin, context, sp,
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames, persistenceLayer
)
val handler = mock(Handler::class.java)
`when`(handler.post(anyObject())).thenAnswer { invocation: InvocationOnMock ->

View file

@ -12,6 +12,7 @@ import info.nightscout.implementation.queue.commands.CommandTempBasalAbsolute
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.db.PersistenceLayer
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpDescription
@ -34,6 +35,7 @@ class QueueThreadTest : TestBaseWithProfile() {
@Mock lateinit var repository: AppRepository
@Mock lateinit var androidPermission: AndroidPermission
@Mock lateinit var activityNames: ActivityNames
@Mock lateinit var persistenceLayer: PersistenceLayer
val injector = HasAndroidInjector {
AndroidInjector {
@ -58,7 +60,7 @@ class QueueThreadTest : TestBaseWithProfile() {
commandQueue = CommandQueueImplementation(
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
profileFunction, activePlugin, context, sp,
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames, persistenceLayer
)
val pumpDescription = PumpDescription()