fix tests
This commit is contained in:
parent
80f6050d04
commit
c7c63f8403
3 changed files with 10 additions and 7 deletions
|
@ -6,7 +6,6 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.extensions.pureProfileFromJson
|
import info.nightscout.androidaps.extensions.pureProfileFromJson
|
||||||
import info.nightscout.core.profile.ProfileSealed
|
import info.nightscout.core.profile.ProfileSealed
|
||||||
import info.nightscout.core.profile.ProfileStoreObject
|
import info.nightscout.core.profile.ProfileStoreObject
|
||||||
import info.nightscout.database.impl.AppRepository
|
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.profile.DefaultValueHelper
|
import info.nightscout.interfaces.profile.DefaultValueHelper
|
||||||
|
@ -34,7 +33,6 @@ open class TestBaseWithProfile : TestBase() {
|
||||||
@Mock lateinit var config: Config
|
@Mock lateinit var config: Config
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
@Mock lateinit var context: Context
|
@Mock lateinit var context: Context
|
||||||
@Mock lateinit var repository: AppRepository
|
|
||||||
|
|
||||||
private lateinit var hardLimits: HardLimits
|
private lateinit var hardLimits: HardLimits
|
||||||
lateinit var testPumpPlugin: TestPumpPlugin
|
lateinit var testPumpPlugin: TestPumpPlugin
|
||||||
|
|
|
@ -21,6 +21,7 @@ import info.nightscout.interfaces.AndroidPermission
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.constraints.Constraint
|
import info.nightscout.interfaces.constraints.Constraint
|
||||||
import info.nightscout.interfaces.constraints.Constraints
|
import info.nightscout.interfaces.constraints.Constraints
|
||||||
|
import info.nightscout.interfaces.db.PersistenceLayer
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.pump.DetailedBolusInfo
|
import info.nightscout.interfaces.pump.DetailedBolusInfo
|
||||||
|
@ -56,6 +57,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
@Mock lateinit var activityNames: ActivityNames
|
@Mock lateinit var activityNames: ActivityNames
|
||||||
@Mock lateinit var androidPermission: AndroidPermission
|
@Mock lateinit var androidPermission: AndroidPermission
|
||||||
|
@Mock lateinit var persistenceLayer: PersistenceLayer
|
||||||
|
|
||||||
class CommandQueueMocked(
|
class CommandQueueMocked(
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
|
@ -73,11 +75,12 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
repository: AppRepository,
|
repository: AppRepository,
|
||||||
fabricPrivacy: FabricPrivacy,
|
fabricPrivacy: FabricPrivacy,
|
||||||
androidPermission: AndroidPermission,
|
androidPermission: AndroidPermission,
|
||||||
activityNames: ActivityNames
|
activityNames: ActivityNames,
|
||||||
|
persistenceLayer: PersistenceLayer
|
||||||
) : CommandQueueImplementation(
|
) : CommandQueueImplementation(
|
||||||
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction,
|
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction,
|
||||||
activePlugin, context, sp, config, dateUtil, repository, fabricPrivacy,
|
activePlugin, context, sp, config, dateUtil, repository, fabricPrivacy,
|
||||||
androidPermission, activityNames
|
androidPermission, activityNames, persistenceLayer
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun notifyAboutNewCommand() : Boolean = true
|
override fun notifyAboutNewCommand() : Boolean = true
|
||||||
|
@ -121,7 +124,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||||
config, dateUtil, repository,
|
config, dateUtil, repository,
|
||||||
fabricPrivacy, androidPermission, activityNames
|
fabricPrivacy, androidPermission, activityNames, persistenceLayer
|
||||||
)
|
)
|
||||||
testPumpPlugin = TestPumpPlugin(injector)
|
testPumpPlugin = TestPumpPlugin(injector)
|
||||||
|
|
||||||
|
@ -158,7 +161,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
val commandQueue = CommandQueueImplementation(
|
val commandQueue = CommandQueueImplementation(
|
||||||
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||||
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames
|
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames, persistenceLayer
|
||||||
)
|
)
|
||||||
val handler = mock(Handler::class.java)
|
val handler = mock(Handler::class.java)
|
||||||
`when`(handler.post(anyObject())).thenAnswer { invocation: InvocationOnMock ->
|
`when`(handler.post(anyObject())).thenAnswer { invocation: InvocationOnMock ->
|
||||||
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.implementation.queue.commands.CommandTempBasalAbsolute
|
||||||
import info.nightscout.interfaces.AndroidPermission
|
import info.nightscout.interfaces.AndroidPermission
|
||||||
import info.nightscout.interfaces.constraints.Constraint
|
import info.nightscout.interfaces.constraints.Constraint
|
||||||
import info.nightscout.interfaces.constraints.Constraints
|
import info.nightscout.interfaces.constraints.Constraints
|
||||||
|
import info.nightscout.interfaces.db.PersistenceLayer
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.pump.PumpSync
|
import info.nightscout.interfaces.pump.PumpSync
|
||||||
import info.nightscout.interfaces.pump.defs.PumpDescription
|
import info.nightscout.interfaces.pump.defs.PumpDescription
|
||||||
|
@ -34,6 +35,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
@Mock lateinit var androidPermission: AndroidPermission
|
@Mock lateinit var androidPermission: AndroidPermission
|
||||||
@Mock lateinit var activityNames: ActivityNames
|
@Mock lateinit var activityNames: ActivityNames
|
||||||
|
@Mock lateinit var persistenceLayer: PersistenceLayer
|
||||||
|
|
||||||
val injector = HasAndroidInjector {
|
val injector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
|
@ -58,7 +60,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
commandQueue = CommandQueueImplementation(
|
commandQueue = CommandQueueImplementation(
|
||||||
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
|
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
|
||||||
profileFunction, activePlugin, context, sp,
|
profileFunction, activePlugin, context, sp,
|
||||||
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames
|
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames, persistenceLayer
|
||||||
)
|
)
|
||||||
|
|
||||||
val pumpDescription = PumpDescription()
|
val pumpDescription = PumpDescription()
|
||||||
|
|
Loading…
Reference in a new issue