diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index 6cd8b0e2ca..7f5806e962 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -115,7 +115,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context) danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, danaRPump, dateUtil) danaRSPlugin = DanaRSPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) - insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsPlugin, sp, commandQueue, profileFunction, context, dateUtil) + insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsPlugin, sp, commandQueue, profileFunction, context, Config(), dateUtil) openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy) openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy) safetyPlugin = SafetyPlugin(injector, aapsLogger, resourceHelper, sp, rxBus, constraintChecker, openAPSAMAPlugin, openAPSSMBPlugin, sensitivityOref1Plugin, activePlugin, hardLimits, buildHelper, treatmentsPlugin, Config()) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPluginTest.kt index 5485c6ae9d..effe08b5f8 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPluginTest.kt @@ -63,10 +63,6 @@ class DanaRSPluginTest : DanaRSTestBase() { Mockito.`when`(resourceHelper.gs(eq(R.string.limitingbasalratio), anyObject(), anyObject())).thenReturn("limitingbasalratio") Mockito.`when`(resourceHelper.gs(eq(R.string.limitingpercentrate), anyObject(), anyObject())).thenReturn("limitingpercentrate") -<<<<<<< HEAD - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy) -======= - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, dateUtil) ->>>>>>> origin/dev + danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRSMessageHashTableTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRSMessageHashTableTest.kt index 4bcf9b4c92..4ad7df5359 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRSMessageHashTableTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRSMessageHashTableTest.kt @@ -1,23 +1,13 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm -<<<<<<< HEAD import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -======= -import android.content.Context -import com.cozmo.danar.util.BleCommandUtil ->>>>>>> origin/dev import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump -<<<<<<< HEAD import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption -======= -import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin -import info.nightscout.androidaps.utils.DateUtil ->>>>>>> origin/dev import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -30,11 +20,6 @@ import org.powermock.modules.junit4.PowerMockRunner @PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class) class DanaRSMessageHashTableTest : DanaRSTestBase() { -<<<<<<< HEAD -======= - @Mock lateinit var context: Context - @Mock lateinit var danaRSPlugin: DanaRSPlugin ->>>>>>> origin/dev @Mock lateinit var activePlugin: ActivePluginProvider @Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @@ -43,6 +28,7 @@ class DanaRSMessageHashTableTest : DanaRSTestBase() { AndroidInjector { if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil } if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) { it.constraintChecker = constraintChecker @@ -60,13 +46,8 @@ class DanaRSMessageHashTableTest : DanaRSTestBase() { fun runTest() { `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) -<<<<<<< HEAD val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector) val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(packetInjector, DanaRPump.CARBS, 0, 0, 0) -======= - val danaRSMessageHashTable = DanaRSMessageHashTable(aapsLogger, rxBus, resourceHelper, danaRPump, danaRSPlugin, activePlugin, constraintChecker, detailedBolusInfoStorage, injector, DateUtil(context, resourceHelper)) - val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(aapsLogger, dateUtil, DanaRPump.CARBS, 0, 0, 0) ->>>>>>> origin/dev val testPacket: DanaRS_Packet = danaRSMessageHashTable.findMessage(forTesting.command) Assert.assertEquals(BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.getOpCode().toLong()) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_History_EventsTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_History_EventsTest.kt index 6b7835ffbd..20aaa5591d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_History_EventsTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_History_EventsTest.kt @@ -26,8 +26,11 @@ class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_APS_History_Events) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_APS_History_Events) { it.rxBus = rxBus it.resourceHelper = resourceHelper it.activePlugin = activePlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt index b252c07830..36146b4ca9 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt @@ -16,8 +16,11 @@ class DanaRS_Packet_APS_Set_Event_HistoryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_APS_Set_Event_History) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_APS_Set_Event_History) { } } } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt index 115dba03b0..56e308fc1f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt @@ -14,8 +14,11 @@ class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_Basal_Get_Temporary_Basal_State) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_Basal_Get_Temporary_Basal_State) { it.danaRPump = danaRPump } } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt index 0979f33075..9d250d8872 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt @@ -15,15 +15,17 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_Bolus_Get_Step_Bolus_Information) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_Bolus_Get_Step_Bolus_Information) { it.danaRPump = danaRPump } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_Bolus_Get_Step_Bolus_Information(packetInjector) val array = createArray(13, 0.toByte()) // 11 + 2 @@ -45,17 +47,6 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() { Assert.assertEquals(12.5, danaRPump.lastBolusAmount, 0.01) Assert.assertEquals(25.0, danaRPump.maxBolus, 0.01) Assert.assertEquals(1.0, danaRPump.bolusStep, 0.01) -======= - val packet = DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump, dateUtil) - Assert.assertEquals(null, packet.requestParams) - // test message decoding - packet.handleMessage(createArray(34, 0.toByte())) - Assert.assertEquals(false, packet.failed) - packet.handleMessage(createArray(34, 1.toByte())) - val valueRequested: Int = (1 and 0x000000FF shl 8) + (1 and 0x000000FF) - Assert.assertEquals(valueRequested / 100.0, danaRPump.lastBolusAmount, 0.0) - Assert.assertEquals(true, packet.failed) ->>>>>>> origin/dev Assert.assertEquals("BOLUS__GET_STEP_BOLUS_INFORMATION", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt index da0bbc434f..b69ffe2ee3 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt @@ -54,11 +54,7 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest : DanaRSTestBase() { @Before fun mock() { -<<<<<<< HEAD - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy) -======= - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, dateUtil) ->>>>>>> origin/dev + danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt index f0d67530c5..0b68225a54 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt @@ -2,14 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin -<<<<<<< HEAD -import info.nightscout.androidaps.plugins.treatments.Treatment -======= -import info.nightscout.androidaps.db.Treatment ->>>>>>> origin/dev import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt index ee57e0b1f2..7d93a60dbd 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt @@ -13,15 +13,17 @@ class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_General_Get_More_Information) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_General_Get_More_Information) { it.danaRPump = danaRPump } } } @Test fun runTest() { -<<<<<<< HEAD var packet = DanaRS_Packet_General_Get_More_Information(packetInjector) packet.handleMessage(createArray(14, 0.toByte())) @@ -48,19 +50,6 @@ class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() { Assert.assertEquals(25, lastBolus.minutes) Assert.assertEquals(1.7, danaRPump.lastBolusAmount, 0.01) -======= - var packet = DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump, dateUtil) - Assert.assertEquals(null, packet.requestParams) - // test message decoding - // test for the length message - packet.handleMessage(createArray(13, 0.toByte())) - Assert.assertEquals(true, packet.failed) - packet = DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump, dateUtil) - packet.handleMessage(createArray(15, 0.toByte())) - Assert.assertEquals(false, packet.failed) - packet.handleMessage(createArray(15, 161.toByte())) - Assert.assertEquals(true, packet.failed) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__GET_MORE_INFORMATION", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt index 8f2d792423..f9247b152b 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt @@ -12,30 +12,25 @@ class DanaRS_Packet_General_Get_Shipping_InformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_General_Get_Shipping_Information) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_General_Get_Shipping_Information) { it.danaRPump = danaRPump } } } @Test fun runTest() { -<<<<<<< HEAD var packet = DanaRS_Packet_General_Get_Shipping_Information(packetInjector) -======= - var packet = DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump, dateUtil) ->>>>>>> origin/dev Assert.assertEquals(null, packet.requestParams) // test message decoding // test for the length message packet.handleMessage(createArray(1, 0.toByte())) Assert.assertEquals(true, packet.failed) // everything ok :) -<<<<<<< HEAD packet = DanaRS_Packet_General_Get_Shipping_Information(packetInjector) -======= - packet = DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump, dateUtil) ->>>>>>> origin/dev packet.handleMessage(createArray(18, 0.toByte())) Assert.assertEquals(false, packet.failed) Assert.assertEquals("REVIEW__GET_SHIPPING_INFORMATION", packet.friendlyName) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_AlarmTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_AlarmTest.kt index 0485d8a06e..7b64daa632 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_AlarmTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_AlarmTest.kt @@ -20,7 +20,6 @@ import java.util.* @PrepareForTest(MainApp::class) class DanaRS_Packet_History_AlarmTest : DanaRSTestBase() { -<<<<<<< HEAD @Mock lateinit var databaseHelper: DatabaseHelper @Before @@ -31,8 +30,11 @@ class DanaRS_Packet_History_AlarmTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Alarm) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Alarm) { it.rxBus = rxBus } } @@ -59,10 +61,6 @@ class DanaRS_Packet_History_AlarmTest : DanaRSTestBase() { Assert.assertEquals(Date(119, 1, 4, 20, 11, 35).time, packet.danaRHistoryRecord.recordDate) Assert.assertEquals("Occlusion", packet.danaRHistoryRecord.recordAlarm) Assert.assertEquals(3.56, packet.danaRHistoryRecord.recordValue, 0.01) -======= - @Test fun runTest() { - val packet = DanaRS_Packet_History_Alarm(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__ALARM", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_All_HistoryTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_All_HistoryTest.kt index 7aea8d84a9..6913ec5da1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_All_HistoryTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_All_HistoryTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_All_HistoryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_All_History) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_All_History) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_All_History(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_All_History(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__ALL_HISTORY", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BasalTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BasalTest.kt index a34513a30a..227e305eba 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BasalTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BasalTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_BasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Basal) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Basal) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Basal(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Basal(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__BASAL", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt index 152bc1e7fc..9c1474ebe2 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_Blood_GlucoseTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Blood_Glucose) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Blood_Glucose) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Blood_Glucose(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__BLOOD_GLUCOSE", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BolusTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BolusTest.kt index 44fede7ae9..202f52d0be 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BolusTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_BolusTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_BolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Bolus) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Bolus) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Bolus(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Bolus(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__BOLUS", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_CarbohydrateTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_CarbohydrateTest.kt index 4e2544107e..93d40faac9 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_CarbohydrateTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_CarbohydrateTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_CarbohydrateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Carbohydrate) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Carbohydrate) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Carbohydrate(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__CARBOHYDRATE", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_DailyTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_DailyTest.kt index 5564ba584c..00b407f32a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_DailyTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_DailyTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_DailyTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Daily) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Daily) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Daily(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Daily(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__DAILY", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_PrimeTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_PrimeTest.kt index 592d45be98..59ed19ac48 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_PrimeTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_PrimeTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_PrimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Prime) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Prime) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Prime(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Prime(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__PRIME", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_RefillTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_RefillTest.kt index 84ea21d91c..832d52f6e6 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_RefillTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_RefillTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_RefillTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Refill) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Refill) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Refill(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Refill(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__REFILL", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_SuspendTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_SuspendTest.kt index 7b0300aaef..f1f612fe13 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_SuspendTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_SuspendTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_SuspendTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Suspend) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Suspend) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Suspend(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Suspend(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__SUSPEND", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_TemporaryTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_TemporaryTest.kt index e0dc156d8a..0a74282ddd 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_TemporaryTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_History_TemporaryTest.kt @@ -12,19 +12,18 @@ class DanaRS_Packet_History_TemporaryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_History_Temporary) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_History_Temporary) { it.rxBus = rxBus } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_History_Temporary(packetInjector, System.currentTimeMillis()) -======= - val packet = DanaRS_Packet_History_Temporary(aapsLogger, rxBus, dateUtil, System.currentTimeMillis()) ->>>>>>> origin/dev Assert.assertEquals("REVIEW__TEMPORARY", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt index 065fc9ce6f..9e437107b1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt @@ -2,14 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin -<<<<<<< HEAD -import info.nightscout.androidaps.plugins.treatments.Treatment -======= -import info.nightscout.androidaps.db.Treatment ->>>>>>> origin/dev import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt index b026c4f7bf..d015035113 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt @@ -3,17 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin -<<<<<<< HEAD -import info.nightscout.androidaps.plugins.treatments.Treatment -======= -import info.nightscout.androidaps.db.Treatment ->>>>>>> origin/dev import org.junit.Assert import org.junit.Before import org.junit.Test @@ -71,12 +67,7 @@ class DanaRS_Packet_Notify_Delivery_Rate_DisplayTest : DanaRSTestBase() { @Before fun mock() { -<<<<<<< HEAD - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy) + danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) danaRPump.bolusingTreatment = Treatment(packetInjector) -======= - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage, dateUtil) - danaRSPlugin.bolusingTreatment = Treatment(treatmentInjector) ->>>>>>> origin/dev } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt index 7298f57d19..1c64b0d82a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt @@ -13,15 +13,17 @@ class DanaRS_Packet_Option_Get_Pump_TimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_Option_Get_Pump_Time) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_Option_Get_Pump_Time) { it.danaRPump = danaRPump } } } @Test fun runTest() { -<<<<<<< HEAD val packet = DanaRS_Packet_Option_Get_Pump_Time(packetInjector) val array = createArray(8, 0.toByte()) // 6 + 2 putByteToArray(array, 0, 19) // year 2019 @@ -33,17 +35,6 @@ class DanaRS_Packet_Option_Get_Pump_TimeTest : DanaRSTestBase() { packet.handleMessage(array) Assert.assertEquals(DateTime(2019, 2, 4, 20, 11, 35).millis, danaRPump.pumpTime) -======= - val packet = DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump, dateUtil) - // test params - Assert.assertEquals(null, packet.requestParams) - // test message decoding - packet.handleMessage(createArray(8, 0.toByte())) - Assert.assertEquals(false, packet.failed) - // this should fail - packet.handleMessage(createArray(8, 1.toByte())) - Assert.assertEquals(true, packet.failed) ->>>>>>> origin/dev Assert.assertEquals("OPTION__GET_PUMP_TIME", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt index f9ca5fe57d..67a9eed70d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt @@ -13,19 +13,18 @@ class DanaRS_Packet_Option_Set_Pump_TimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { - if (it is DanaRS_Packet_Option_Set_Pump_Time) { + if (it is DanaRS_Packet) { it.aapsLogger = aapsLogger + it.dateUtil = dateUtil + } + if (it is DanaRS_Packet_Option_Set_Pump_Time) { } } } @Test fun runTest() { -<<<<<<< HEAD val date = Date() val packet = DanaRS_Packet_Option_Set_Pump_Time(packetInjector, date.time) -======= - val packet = DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, dateUtil, DateUtil.now()) ->>>>>>> origin/dev // test params val params = packet.requestParams Assert.assertEquals((date.year - 100 and 0xff).toByte(), params[0]) // 2019 -> 19