fix tests
This commit is contained in:
parent
156738a5cb
commit
3dda4f8f9d
3 changed files with 9 additions and 11 deletions
|
@ -331,7 +331,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
//LOOP DISABLE : from enabled
|
//LOOP DISABLE : from enabled
|
||||||
hasBeenRun = false
|
hasBeenRun = false
|
||||||
PowerMockito.`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true)
|
PowerMockito.`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true)
|
||||||
PowerMockito.doAnswer(Answer { invocation: InvocationOnMock? ->
|
PowerMockito.doAnswer(Answer { _: InvocationOnMock? ->
|
||||||
hasBeenRun = true
|
hasBeenRun = true
|
||||||
null
|
null
|
||||||
} as Answer<*>).`when`(loopPlugin).setPluginEnabled(PluginType.LOOP, false)
|
} as Answer<*>).`when`(loopPlugin).setPluginEnabled(PluginType.LOOP, false)
|
||||||
|
@ -355,7 +355,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
//LOOP ENABLE : from disabled
|
//LOOP ENABLE : from disabled
|
||||||
hasBeenRun = false
|
hasBeenRun = false
|
||||||
PowerMockito.`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(false)
|
PowerMockito.`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(false)
|
||||||
PowerMockito.doAnswer(Answer { invocation: InvocationOnMock? ->
|
PowerMockito.doAnswer(Answer { _: InvocationOnMock? ->
|
||||||
hasBeenRun = true
|
hasBeenRun = true
|
||||||
null
|
null
|
||||||
} as Answer<*>).`when`(loopPlugin).setPluginEnabled(PluginType.LOOP, true)
|
} as Answer<*>).`when`(loopPlugin).setPluginEnabled(PluginType.LOOP, true)
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.iob.iobCobCalculatorPlugin
|
package info.nightscout.androidaps.plugins.iob.iobCobCalculatorPlugin
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.MainApp
|
|
||||||
import info.nightscout.androidaps.TestBase
|
import info.nightscout.androidaps.TestBase
|
||||||
import info.nightscout.androidaps.db.BgReading
|
import info.nightscout.androidaps.db.BgReading
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.L
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
||||||
|
@ -19,6 +15,7 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAverage
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
|
@ -32,6 +29,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
|
@PrepareForTest(FabricPrivacy::class)
|
||||||
class IobCobCalculatorPluginTest : TestBase() {
|
class IobCobCalculatorPluginTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var aapsLogger: AAPSLogger
|
@Mock lateinit var aapsLogger: AAPSLogger
|
||||||
|
@ -45,6 +43,7 @@ class IobCobCalculatorPluginTest : TestBase() {
|
||||||
@Mock lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin
|
@Mock lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin
|
||||||
@Mock lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin
|
@Mock lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin
|
||||||
@Mock lateinit var defaultValueHelper: DefaultValueHelper
|
@Mock lateinit var defaultValueHelper: DefaultValueHelper
|
||||||
|
@Mock lateinit var fabricPrivacy: FabricPrivacy
|
||||||
|
|
||||||
lateinit var iobCobCalculatorPlugin: IobCobCalculatorPlugin
|
lateinit var iobCobCalculatorPlugin: IobCobCalculatorPlugin
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ class IobCobCalculatorPluginTest : TestBase() {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun mock() {
|
fun mock() {
|
||||||
iobCobCalculatorPlugin = IobCobCalculatorPlugin(injector, aapsLogger, rxBus, sp, resourceHelper, profileFunction, activePlugin, treatmentsPlugin, sensitivityOref1Plugin, sensitivityAAPSPlugin, sensitivityWeightedAveragePlugin)
|
iobCobCalculatorPlugin = IobCobCalculatorPlugin(injector, aapsLogger, rxBus, sp, resourceHelper, profileFunction, activePlugin, treatmentsPlugin, sensitivityOref1Plugin, sensitivityAAPSPlugin, sensitivityWeightedAveragePlugin, fabricPrivacy)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -16,10 +16,9 @@ class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() {
|
||||||
val array = ByteArray(100)
|
val array = ByteArray(100)
|
||||||
putByteToArray(array, 0, 1.toByte())
|
putByteToArray(array, 0, 1.toByte())
|
||||||
putByteToArray(array, 1, 1.toByte())
|
putByteToArray(array, 1, 1.toByte())
|
||||||
putByteToArray(array, 2, 2.toByte())
|
putByteToArray(array, 2, 230.toByte())
|
||||||
putByteToArray(array, 3, 230.toByte())
|
putByteToArray(array, 3, 150.toByte())
|
||||||
putByteToArray(array, 4, 150.toByte())
|
putIntToArray(array, 4, 1)
|
||||||
putIntToArray(array, 5, 1)
|
|
||||||
packet.handleMessage(array)
|
packet.handleMessage(array)
|
||||||
Assert.assertTrue(packet.failed)
|
Assert.assertTrue(packet.failed)
|
||||||
Assert.assertTrue(danaRPump.isTempBasalInProgress)
|
Assert.assertTrue(danaRPump.isTempBasalInProgress)
|
||||||
|
|
Loading…
Reference in a new issue