Fix test
This commit is contained in:
parent
a12762f034
commit
5c04780de1
|
@ -24,14 +24,9 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorP
|
||||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentService
|
import info.nightscout.androidaps.plugins.treatments.TreatmentService
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.queue.CommandQueue
|
import info.nightscout.androidaps.queue.CommandQueue
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.*
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
|
||||||
import info.nightscout.androidaps.utils.T
|
|
||||||
import info.nightscout.androidaps.utils.XdripCalibrations
|
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
@ -49,7 +44,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
@PrepareForTest(ConstraintChecker::class, FabricPrivacy::class, VirtualPumpPlugin::class, XdripCalibrations::class, SmsManager::class, RxBusWrapper::class, CommandQueue::class, LocalProfilePlugin::class, DateUtil::class, IobCobCalculatorPlugin::class, MainApp::class)
|
@PrepareForTest(ConstraintChecker::class, FabricPrivacy::class, VirtualPumpPlugin::class, XdripCalibrations::class, SmsManager::class, CommandQueue::class, LocalProfilePlugin::class, DateUtil::class, IobCobCalculatorPlugin::class, OneTimePassword::class)
|
||||||
class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
|
@ -63,6 +58,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var defaultValueHelper: DefaultValueHelper
|
@Mock lateinit var defaultValueHelper: DefaultValueHelper
|
||||||
@Mock lateinit var localProfilePlugin: LocalProfilePlugin
|
@Mock lateinit var localProfilePlugin: LocalProfilePlugin
|
||||||
@Mock lateinit var treatmentService: TreatmentService
|
@Mock lateinit var treatmentService: TreatmentService
|
||||||
|
@Mock lateinit var otp: OneTimePassword
|
||||||
|
|
||||||
var injector: HasAndroidInjector = HasAndroidInjector {
|
var injector: HasAndroidInjector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
|
@ -80,6 +76,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
it.smsCommunicatorPlugin = smsCommunicatorPlugin
|
it.smsCommunicatorPlugin = smsCommunicatorPlugin
|
||||||
it.resourceHelper = resourceHelper
|
it.resourceHelper = resourceHelper
|
||||||
|
it.otp = otp
|
||||||
}
|
}
|
||||||
if (it is GlucoseStatus) {
|
if (it is GlucoseStatus) {
|
||||||
it.aapsLogger = aapsLogger
|
it.aapsLogger = aapsLogger
|
||||||
|
@ -109,7 +106,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
`when`(SmsManager.getDefault()).thenReturn(smsManager)
|
`when`(SmsManager.getDefault()).thenReturn(smsManager)
|
||||||
`when`(sp.getString(R.string.key_smscommunicator_allowednumbers, "")).thenReturn("1234;5678")
|
`when`(sp.getString(R.string.key_smscommunicator_allowednumbers, "")).thenReturn("1234;5678")
|
||||||
|
|
||||||
smsCommunicatorPlugin = SmsCommunicatorPlugin(injector, aapsLogger, resourceHelper, sp, constraintChecker, rxBus, profileFunction, fabricPrivacy, activePlugin, commandQueue, loopPlugin, iobCobCalculatorPlugin)
|
smsCommunicatorPlugin = SmsCommunicatorPlugin(injector, aapsLogger, resourceHelper, sp, constraintChecker, rxBus, profileFunction, fabricPrivacy, activePlugin, commandQueue, loopPlugin, iobCobCalculatorPlugin, otp)
|
||||||
smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true)
|
smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true)
|
||||||
Mockito.doAnswer { invocation: InvocationOnMock ->
|
Mockito.doAnswer { invocation: InvocationOnMock ->
|
||||||
val callback = invocation.getArgument<Callback>(1)
|
val callback = invocation.getArgument<Callback>(1)
|
||||||
|
|
Loading…
Reference in a new issue