From 738964faef63ef7806106d821d757c0a00095417 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 18 Feb 2021 20:45:32 +0100 Subject: [PATCH] move RS tests --- .gitignore | 2 +- .../androidaps/TestBaseWithProfile.kt | 21 ++--- .../androidaps/dana/ExampleUnitTest.kt | 18 ---- danars/build.gradle | 8 +- .../info/nightscout/androidaps/TestBase.kt | 40 +++++++++ .../androidaps/TestBaseWithProfile.kt | 82 +++++++++++++++++++ .../androidaps/danars}/DanaRSPluginTest.kt | 11 ++- .../androidaps/danars}/DanaRSTestBase.kt | 8 +- .../DanaRSPacketBasalSetTemporaryBasalTest.kt | 3 +- .../comm/DanaRSPacketHistoryAlarmTest.kt | 6 +- .../DanaRSPacketNotifyDeliveryCompleteTest.kt | 6 +- .../DanaRSPacketOptionSetUserOptionTest.kt | 3 +- .../androidaps/danars/comm/DanaRSTestBase.kt | 2 + .../danars/comm/DanaRsMessageHashTableTest.kt | 5 +- ...naRsPacketApsBasalSetTemporaryBasalTest.kt | 6 +- .../comm/DanaRsPacketApsHistoryEventsTest.kt | 5 +- .../DanaRsPacketApsSetEventHistoryTest.kt | 25 +++--- .../comm/DanaRsPacketBasalGetBasalRateTest.kt | 5 +- ...anaRsPacketBasalGetProfileBasalRateTest.kt | 3 +- .../DanaRsPacketBasalGetProfileNumberTest.kt | 5 +- ...RsPacketBasalGetTemporaryBasalStateTest.kt | 5 +- .../comm/DanaRsPacketBasalSetBasalRateTest.kt | 5 +- ...sPacketBasalSetCancelTemporaryBasalTest.kt | 5 +- ...anaRsPacketBasalSetProfileBasalRateTest.kt | 11 ++- .../DanaRsPacketBasalSetProfileNumberTest.kt | 9 +- .../DanaRsPacketBasalSetSuspendOffTest.kt | 5 +- .../comm/DanaRsPacketBasalSetSuspendOnTest.kt | 5 +- .../DanaRsPacketBolusGetBolusOptionTest.kt | 3 +- ...acketBolusGetCalculationInformationTest.kt | 5 +- ...tCarbohydrateCalculationInformationTest.kt | 5 +- .../DanaRsPacketBolusGetCirCfArrayTest.kt | 3 +- .../comm/DanaRsPacketBolusGetDualBolusTest.kt | 3 +- ...aRsPacketBolusGetExtendedBolusStateTest.kt | 9 +- .../DanaRsPacketBolusGetExtendedBolusTest.kt | 11 ++- ...cketBolusGetExtendedMenuOptionStateTest.kt | 5 +- .../DanaRsPacketBolusGetInitialBolusTest.kt | 5 +- ...sPacketBolusGetStepBolusInformationTest.kt | 12 +-- .../DanaRsPacketBolusSetBolusOptionTest.kt | 9 +- .../DanaRsPacketBolusSetCirCfArrayTest.kt | 9 +- .../comm/DanaRsPacketBolusSetDualBolusTest.kt | 9 +- ...RsPacketBolusSetExtendedBolusCancelTest.kt | 3 +- .../DanaRsPacketBolusSetExtendedBolusTest.kt | 3 +- .../DanaRsPacketBolusSetInitialBolusTest.kt | 9 +- .../DanaRsPacketBolusSetStepBolusStartTest.kt | 9 +- .../DanaRsPacketBolusSetStepBolusStopTest.kt | 5 +- .../comm/DanaRsPacketEtcKeepConnectionTest.kt | 3 +- .../comm/DanaRsPacketEtcSetHistorySaveTest.kt | 11 ++- .../DanaRsPacketGeneralDeliveryStatusTest.kt | 5 +- ...naRsPacketGeneralGetMoreInformationTest.kt | 12 +-- .../DanaRsPacketGeneralGetPasswordTest.kt | 3 +- .../DanaRsPacketGeneralGetPumpCheckTest.kt | 3 +- ...PacketGeneralGetShippingInformationTest.kt | 3 +- ...naRsPacketGeneralGetShippingVerisonTest.kt | 3 +- ...sPacketGeneralGetTodayDeliveryTotalTest.kt | 3 +- ...sPacketGeneralGetUserTimeChangeFlagTest.kt | 3 +- ...cketGeneralInitialScreenInformationTest.kt | 3 +- ...RsPacketGeneralSetHistoryUploadModeTest.kt | 3 +- ...etGeneralSetUserTimeChangeFlagClearTest.kt | 3 +- .../comm/DanaRsPacketHistoryAllHistoryTest.kt | 3 +- .../comm/DanaRsPacketHistoryBasalTest.kt | 3 +- .../DanaRsPacketHistoryBloodGlucoseTest.kt | 3 +- .../comm/DanaRsPacketHistoryBolusTest.kt | 3 +- .../DanaRsPacketHistoryCarbohydrateTest.kt | 3 +- .../comm/DanaRsPacketHistoryDailyTest.kt | 3 +- .../comm/DanaRsPacketHistoryPrimeTest.kt | 3 +- .../comm/DanaRsPacketHistoryRefillTest.kt | 3 +- .../comm/DanaRsPacketHistorySuspendTest.kt | 3 +- .../comm/DanaRsPacketHistoryTemporaryTest.kt | 3 +- .../comm/DanaRsPacketNotifyAlarmTest.kt | 14 +--- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 6 +- .../DanaRsPacketNotifyMissedBolusAlarmTest.kt | 3 +- .../comm/DanaRsPacketOptionGetPumpTimeTest.kt | 3 +- .../DanaRsPacketOptionGetUserOptionTest.kt | 3 +- .../comm/DanaRsPacketOptionSetPumpTimeTest.kt | 23 +++--- .../comm/DanaRsPacketReviewBolusAvgTest.kt | 5 +- .../DanaRsPacketReviewGetPumpDecRatioTest.kt | 3 +- 76 files changed, 355 insertions(+), 219 deletions(-) delete mode 100644 dana/src/test/java/info/nightscout/androidaps/dana/ExampleUnitTest.kt create mode 100644 danars/src/test/java/info/nightscout/androidaps/TestBase.kt create mode 100644 danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt rename {app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS => danars/src/test/java/info/nightscout/androidaps/danars}/DanaRSPluginTest.kt (84%) rename {app/src/test/java/info/nightscout/androidaps/danars/comm => danars/src/test/java/info/nightscout/androidaps/danars}/DanaRSTestBase.kt (90%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Temporary_BasalTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt (91%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_AlarmTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt (94%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_OptionTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt (90%) create mode 100644 danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSMessageHashTableTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt (95%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt (94%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_EventsTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt (96%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt (73%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_RateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_RateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileBasalRateTest.kt (94%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_NumberTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt (85%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetTemporaryBasalStateTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Basal_RateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetBasalRateTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt (85%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_Basal_RateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt (77%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_NumberTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt (80%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OffTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt (86%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OnTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt (86%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_OptionTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt (93%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt (86%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCarbohydrateCalculationInformationTest.kt (86%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt (91%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_BolusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetDualBolusTest.kt (91%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusStateTest.kt (79%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusTest.kt (77%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedMenuOptionStateTest.kt (86%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetInitialBolusTest.kt (84%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt (82%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Bolus_OptionTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt (81%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetCirCfArrayTest.kt (81%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Dual_BolusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetDualBolusTest.kt (81%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt (88%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_BolusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt (91%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Initial_BolusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetInitialBolusTest.kt (77%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt (94%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt (90%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Set_History_SaveTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt (75%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Delivery_StatusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralDeliveryStatusTest.kt (86%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_InformationTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetMoreInformationTest.kt (81%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_PasswordTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPasswordTest.kt (90%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt (92%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt (90%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_VerisonTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetTodayDeliveryTotalTest.kt (91%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt (90%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_History_Upload_ModeTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_User_Time_Change_Flag_ClearTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_All_HistoryTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BasalTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BolusTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_CarbohydrateTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_DailyTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_PrimeTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_RefillTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_SuspendTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_TemporaryTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_AlarmTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt (75%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Missed_Bolus_AlarmTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt (89%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt (91%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_OptionTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt (90%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt (60%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Bolus_AvgTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt (87%) rename app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_RatioTest.kt => danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt (88%) diff --git a/.gitignore b/.gitignore index affd38763c..74eb164a98 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .gradle /local.properties .DS_Store -app/jacoco.exec +*/jacoco.exec /build /captures *.apk diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 990a4f5b0a..10ffa5c70f 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -3,19 +3,18 @@ package info.nightscout.androidaps import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile -import info.nightscout.androidaps.interfaces.ProfileStore import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.interfaces.ActivePluginProvider -import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.db.Treatment -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin +import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ConfigInterface +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ProfileStore +import info.nightscout.androidaps.interfaces.TreatmentsInterface +import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.resources.ResourceHelper -import info.nightscout.androidaps.utils.rx.AapsSchedulers -import info.nightscout.androidaps.utils.rx.TestAapsSchedulers import org.json.JSONObject import org.junit.Before import org.mockito.Mock @@ -23,13 +22,15 @@ import org.powermock.core.classloader.annotations.PrepareForTest @PrepareForTest(FabricPrivacy::class) open class TestBaseWithProfile : TestBase() { + @Mock lateinit var activePluginProvider: ActivePluginProvider @Mock lateinit var resourceHelper: ResourceHelper - @Mock lateinit var treatmentsPlugin: TreatmentsPlugin + @Mock lateinit var treatmentsPlugin: TreatmentsInterface @Mock lateinit var fabricPrivacy: FabricPrivacy @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var defaultValueHelper: DefaultValueHelper @Mock lateinit var dateUtil: DateUtil + @Mock lateinit var configInterface: ConfigInterface val rxBus = RxBusWrapper(aapsSchedulers) @@ -41,7 +42,7 @@ open class TestBaseWithProfile : TestBase() { it.resourceHelper = resourceHelper it.rxBus = rxBus it.fabricPrivacy = fabricPrivacy - it.configInterface = Config() + it.configInterface = configInterface } if (it is ProfileSwitch) { it.treatmentsPlugin = treatmentsPlugin @@ -61,7 +62,7 @@ open class TestBaseWithProfile : TestBase() { private lateinit var validProfileJSON: String lateinit var validProfile: Profile - val TESTPROFILENAME = "someProfile" + @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" @Before fun prepareMock() { diff --git a/dana/src/test/java/info/nightscout/androidaps/dana/ExampleUnitTest.kt b/dana/src/test/java/info/nightscout/androidaps/dana/ExampleUnitTest.kt deleted file mode 100644 index a85dae0d49..0000000000 --- a/dana/src/test/java/info/nightscout/androidaps/dana/ExampleUnitTest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package info.nightscout.androidaps.dana - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} diff --git a/danars/build.gradle b/danars/build.gradle index 30ee674f9f..a7c5ac60d6 100644 --- a/danars/build.gradle +++ b/danars/build.gradle @@ -7,7 +7,7 @@ android { compileSdkVersion 28 defaultConfig { - minSdkVersion 24 + minSdkVersion 26 targetSdkVersion 28 versionCode 1 versionName "1.0" @@ -35,6 +35,12 @@ android { ext.enableCrashlytics = false } } + flavorDimensions "standard" + productFlavors { + full { + dimension "standard" + } + } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 diff --git a/danars/src/test/java/info/nightscout/androidaps/TestBase.kt b/danars/src/test/java/info/nightscout/androidaps/TestBase.kt new file mode 100644 index 0000000000..573c9dcbcc --- /dev/null +++ b/danars/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -0,0 +1,40 @@ +package info.nightscout.androidaps + +import info.nightscout.androidaps.logging.AAPSLoggerTest +import info.nightscout.androidaps.utils.rx.AapsSchedulers +import info.nightscout.androidaps.utils.rx.TestAapsSchedulers +import org.junit.Before +import org.junit.Rule +import org.mockito.Mockito +import org.mockito.junit.MockitoJUnit +import org.mockito.junit.MockitoRule +import java.util.* + +@Suppress("SpellCheckingInspection") +open class TestBase { + + val aapsLogger = AAPSLoggerTest() + val aapsSchedulers: AapsSchedulers = TestAapsSchedulers() + + // Add a JUnit rule that will setup the @Mock annotated vars and log. + // Another possibility would be to add `MockitoAnnotations.initMocks(this) to the setup method. + @get:Rule + val mockitoRule: MockitoRule = MockitoJUnit.rule() + + @Before + fun setupLocale() { + Locale.setDefault(Locale.ENGLISH) + System.setProperty("disableFirebase", "true") + } + + // Workaround for Kotlin nullability. + // https://medium.com/@elye.project/befriending-kotlin-and-mockito-1c2e7b0ef791 + // https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin + fun anyObject(): T { + Mockito.any() + return uninitialized() + } + + @Suppress("Unchecked_Cast") + fun uninitialized(): T = null as T +} \ No newline at end of file diff --git a/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt new file mode 100644 index 0000000000..e23ced876d --- /dev/null +++ b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -0,0 +1,82 @@ +package info.nightscout.androidaps + +import dagger.android.AndroidInjector +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.Profile +import info.nightscout.androidaps.db.ProfileSwitch +import info.nightscout.androidaps.db.Treatment +import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ConfigInterface +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ProfileStore +import info.nightscout.androidaps.interfaces.TreatmentsInterface +import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.DefaultValueHelper +import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.resources.ResourceHelper +import org.json.JSONObject +import org.junit.Before +import org.mockito.Mock +import org.powermock.core.classloader.annotations.PrepareForTest + +@PrepareForTest(FabricPrivacy::class) +open class TestBaseWithProfile : TestBase() { + + @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var resourceHelper: ResourceHelper + @Mock lateinit var treatmentsPlugin: TreatmentsInterface + @Mock lateinit var fabricPrivacy: FabricPrivacy + @Mock lateinit var profileFunction: ProfileFunction + @Mock lateinit var defaultValueHelper: DefaultValueHelper + @Mock lateinit var dateUtil: DateUtil + @Mock lateinit var configInterface: ConfigInterface + + val rxBus = RxBusWrapper(aapsSchedulers) + + private val profileInjector = HasAndroidInjector { + AndroidInjector { + if (it is Profile) { + it.aapsLogger = aapsLogger + it.activePlugin = activePluginProvider + it.resourceHelper = resourceHelper + it.rxBus = rxBus + it.fabricPrivacy = fabricPrivacy + it.configInterface = configInterface + } + if (it is ProfileSwitch) { + it.treatmentsPlugin = treatmentsPlugin + it.aapsLogger = aapsLogger + it.rxBus = rxBus + it.resourceHelper = resourceHelper + it.dateUtil = dateUtil + } + if (it is Treatment) { + it.activePlugin = activePluginProvider + it.profileFunction = profileFunction + it.defaultValueHelper = defaultValueHelper + it.resourceHelper = resourceHelper + } + } + } + + private lateinit var validProfileJSON: String + lateinit var validProfile: Profile + private val testProfileName = "someProfile" + + @Before + fun prepareMock() { + @Suppress("SpellCheckingInspection") + validProfileJSON = "{\"dia\":\"3\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"100\"},{\"time\":\"2:00\",\"value\":\"110\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}" + validProfile = Profile(profileInjector, JSONObject(validProfileJSON), Constants.MGDL) + } + + fun getValidProfileStore(): ProfileStore { + val json = JSONObject() + val store = JSONObject() + store.put(testProfileName, JSONObject(validProfileJSON)) + json.put("defaultProfile", testProfileName) + json.put("store", store) + return ProfileStore(profileInjector, json) + } +} \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPluginTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt similarity index 84% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPluginTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt index eee474f841..70863cdf8d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPluginTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt @@ -1,13 +1,11 @@ -package info.nightscout.androidaps.plugins.pump.danaRS +package info.nightscout.androidaps.plugins.pump.danars import android.content.Context import dagger.android.AndroidInjector -import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.Config import info.nightscout.androidaps.Constants -import info.nightscout.androidaps.R import info.nightscout.androidaps.danars.DanaRSPlugin -import info.nightscout.androidaps.danars.comm.DanaRSTestBase +import info.nightscout.androidaps.danars.DanaRSTestBase +import info.nightscout.androidaps.danars.R import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType @@ -24,6 +22,7 @@ import org.mockito.Mockito import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner +@Suppress("SpellCheckingInspection") @RunWith(PowerMockRunner::class) @PrepareForTest(ConstraintChecker::class, RxBusWrapper::class, DetailedBolusInfoStorage::class) class DanaRSPluginTest : DanaRSTestBase() { @@ -65,6 +64,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") - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) + danaRSPlugin = DanaRSPlugin({ AndroidInjector { } }, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt b/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSTestBase.kt similarity index 90% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/DanaRSTestBase.kt index ed97c24a55..7984a885a4 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSTestBase.kt @@ -1,10 +1,11 @@ -package info.nightscout.androidaps.danars.comm +package info.nightscout.androidaps.danars import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile -import info.nightscout.androidaps.db.TemporaryBasal import info.nightscout.androidaps.dana.DanaPump +import info.nightscout.androidaps.danars.comm.DanaRS_Packet +import info.nightscout.androidaps.db.TemporaryBasal import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Before import org.mockito.Mock @@ -42,6 +43,7 @@ open class DanaRSTestBase : TestBaseWithProfile() { return ret } + @Suppress("unused") fun putIntToArray(array: ByteArray, position: Int, value: Int): ByteArray { array[DanaRS_Packet.DATA_START + position] = (value and 0xFF).toByte() array[DanaRS_Packet.DATA_START + position + 1] = ((value and 0xFF00) shr 8).toByte() @@ -55,6 +57,6 @@ open class DanaRSTestBase : TestBaseWithProfile() { @Before fun setup() { - danaPump = info.nightscout.androidaps.dana.DanaPump(aapsLogger, sp, injector) + danaPump = DanaPump(aapsLogger, sp, injector) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Temporary_BasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Temporary_BasalTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt index 841f2b8a24..4932678f8b 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Temporary_BasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Basal_Set_Temporary_BasalTest : DanaRSTestBase() { +class DanaRSPacketBasalSetTemporaryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_AlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_AlarmTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt index 3f4c681beb..7d861f35cd 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_AlarmTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import org.junit.Assert @@ -12,7 +13,7 @@ import org.powermock.modules.junit4.PowerMockRunner import java.util.* @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_AlarmTest : DanaRSTestBase() { +class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() { @Mock lateinit var databaseHelper: DatabaseHelperInterface @Mock lateinit var nsUpload: NSUpload @@ -48,7 +49,8 @@ class DanaRS_Packet_History_AlarmTest : DanaRSTestBase() { packet.handleMessage(array) Assert.assertEquals(info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_ALARM, packet.danaRHistoryRecord.recordCode) - Assert.assertEquals(Date(119, 1, 4, 20, 11, 35).time, packet.danaRHistoryRecord.recordDate) + val date = Calendar.getInstance().also { it.set(2019, 2, 4, 20, 11, 35) } + Assert.assertEquals(date.timeInMillis, packet.danaRHistoryRecord.recordDate) Assert.assertEquals("Occlusion", packet.danaRHistoryRecord.recordAlarm) Assert.assertEquals(3.56, packet.danaRHistoryRecord.recordValue, 0.01) Assert.assertEquals("REVIEW__ALARM", packet.friendlyName) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt similarity index 94% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt index 6028dd0941..3ded5b81cd 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_CompleteTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt @@ -2,10 +2,11 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSPlugin +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.danars.DanaRSPlugin import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -18,9 +19,8 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(RxBusWrapper::class, DanaRSPlugin::class) -class DanaRS_Packet_Notify_Delivery_CompleteTest : DanaRSTestBase() { +class DanaRSPacketNotifyDeliveryCompleteTest : DanaRSTestBase() { - @Mock lateinit var danaRSPlugin: DanaRSPlugin @Mock lateinit var activePlugin: ActivePluginProvider private val packetInjector = HasAndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_OptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt similarity index 90% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_OptionTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt index 043fd13178..dfea5dee2f 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_OptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Option_Set_User_OptionTest : DanaRSTestBase() { +class DanaRSPacketOptionSetUserOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt new file mode 100644 index 0000000000..fdc68962c3 --- /dev/null +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt @@ -0,0 +1,2 @@ +package info.nightscout.androidaps.danars.comm + diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSMessageHashTableTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt similarity index 95% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSMessageHashTableTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt index 193f303aa8..2397295ffa 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSMessageHashTableTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt @@ -2,11 +2,12 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.encryption.BleEncryption 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.danars.encryption.BleEncryption +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -17,7 +18,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class) -class DanaRSMessageHashTableTest : DanaRSTestBase() { +class DanaRsMessageHashTableTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePluginProvider @Mock lateinit var constraintChecker: ConstraintChecker diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt similarity index 94% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt index ae09fe8315..d7c9afa3fd 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest : DanaRSTestBase() { +class DanaRsPacketApsBasalSetTemporaryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -20,6 +19,7 @@ class DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest : DanaRSTestBase() { } } + @ExperimentalUnsignedTypes @Test fun runTest() { // under 100% should last 30 min diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_EventsTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt similarity index 96% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_EventsTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt index fe42eb0305..cea0e79c1c 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_EventsTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt @@ -3,10 +3,11 @@ package info.nightscout.androidaps.danars.comm import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.danars.DanaRSPlugin +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.utils.DateUtil import org.junit.Assert import org.junit.Test @@ -18,7 +19,7 @@ import java.util.* @RunWith(PowerMockRunner::class) @PrepareForTest(RxBusWrapper::class, DetailedBolusInfoStorage::class, DanaRSPlugin::class) -class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() { +class DanaRsPacketApsHistoryEventsTest : DanaRSTestBase() { @Mock lateinit var context: Context @Mock lateinit var activePlugin: ActivePluginProvider diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt similarity index 73% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt index 2bbb735ac2..c62418d039 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_Set_Event_HistoryTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt @@ -2,16 +2,15 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.utils.DateUtil import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_APS_Set_Event_HistoryTest : DanaRSTestBase() { +class DanaRsPacketApsSetEventHistoryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -28,22 +27,22 @@ class DanaRS_Packet_APS_Set_Event_HistoryTest : DanaRSTestBase() { @Test fun runTest() { // test for negative carbs val now = DateUtil.now() var historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, -1, 0) - var testparams = historyTest.requestParams - Assert.assertEquals(0.toByte(), testparams[8]) + var testParams = historyTest.requestParams + Assert.assertEquals(0.toByte(), testParams[8]) // 5g carbs historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0) - testparams = historyTest.requestParams - Assert.assertEquals(5.toByte(), testparams[8]) + testParams = historyTest.requestParams + Assert.assertEquals(5.toByte(), testParams[8]) // 150g carbs historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 150, 0) - testparams = historyTest.requestParams - Assert.assertEquals(150.toByte(), testparams[8]) + testParams = historyTest.requestParams + Assert.assertEquals(150.toByte(), testParams[8]) // test message generation historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0) - testparams = historyTest.requestParams - Assert.assertEquals(5.toByte(), testparams[8]) - Assert.assertEquals(11, testparams.size) - Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.CARBS.toByte(), testparams[0]) + testParams = historyTest.requestParams + Assert.assertEquals(5.toByte(), testParams[8]) + Assert.assertEquals(11, testParams.size) + Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.CARBS.toByte(), testParams[0]) // test message decoding historyTest.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) Assert.assertEquals(false, historyTest.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_RateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_RateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt index 935ea4d015..938e716ba7 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_RateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt @@ -3,6 +3,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -11,7 +12,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(RxBusWrapper::class) -class DanaRS_Packet_Basal_Get_Basal_RateTest : DanaRSTestBase() { +class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -30,7 +31,7 @@ class DanaRS_Packet_Basal_Get_Basal_RateTest : DanaRSTestBase() { // rate is 0.01 val array = ByteArray(100) putIntToArray(array, 0, (1.0 * 100).toInt()) - putByteToArray(array, 2, (0.05 * 100).toByte()) + putByteToArray(array, 2, (0.05 * 100).toInt().toByte()) packet.handleMessage(array) Assert.assertEquals(1.0, danaPump.maxBasal, 0.0) Assert.assertEquals(0.05, danaPump.basalStep, 0.0) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_RateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileBasalRateTest.kt similarity index 94% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_RateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileBasalRateTest.kt index 2aa3293eaf..c1cfd49dcd 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_RateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileBasalRateTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest : DanaRSTestBase() { +class DanaRsPacketBasalGetProfileBasalRateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_NumberTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt similarity index 85% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_NumberTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt index 8b430f9146..9847d2f75c 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_NumberTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Get_Profile_NumberTest : DanaRSTestBase() { +class DanaRsPacketBasalGetProfileNumberTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetTemporaryBasalStateTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetTemporaryBasalStateTest.kt index 3ac8c367f1..86bf509924 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetTemporaryBasalStateTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() { +class DanaRsPacketBasalGetTemporaryBasalStateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Basal_RateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetBasalRateTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Basal_RateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetBasalRateTest.kt index 84450ababc..765b2f462a 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Basal_RateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetBasalRateTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Set_Basal_RateTest : DanaRSTestBase() { +class DanaRsPacketBasalSetBasalRateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt similarity index 85% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt index 2cc549c533..442fed73cf 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest : DanaRSTestBase() { +class DanaRsPacketBasalSetCancelTemporaryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_Basal_RateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt similarity index 77% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_Basal_RateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt index fcf254887f..8c45544aa1 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_Basal_RateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Set_Profile_Basal_RateTest : DanaRSTestBase() { +class DanaRsPacketBasalSetProfileBasalRateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -23,11 +22,11 @@ class DanaRS_Packet_Basal_Set_Profile_Basal_RateTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Basal_Set_Profile_Basal_Rate(packetInjector, 1, createArray(24, 1.0)) // test params - val testparams = packet.requestParams + val testParams = packet.requestParams // is profile 1 - Assert.assertEquals(1.toByte(), testparams[0]) + Assert.assertEquals(1.toByte(), testParams[0]) // is value 100 - Assert.assertEquals(100.toByte(), testparams[3]) + Assert.assertEquals(100.toByte(), testParams[3]) // test message decoding packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_NumberTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt similarity index 80% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_NumberTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt index 2e7a720970..d7f1135fb7 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Profile_NumberTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Set_Profile_NumberTest : DanaRSTestBase() { +class DanaRsPacketBasalSetProfileNumberTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -23,9 +22,9 @@ class DanaRS_Packet_Basal_Set_Profile_NumberTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Basal_Set_Profile_Number(packetInjector, 1) // test params - val testparams = packet.requestParams + val testParams = packet.requestParams // is profile 1 - Assert.assertEquals(1.toByte(), testparams[0]) + Assert.assertEquals(1.toByte(), testParams[0]) // test message decoding packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OffTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt similarity index 86% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OffTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt index 24abfb3538..2ebd63d093 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OffTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Set_Suspend_OffTest : DanaRSTestBase() { +class DanaRsPacketBasalSetSuspendOffTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OnTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt similarity index 86% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OnTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt index f0791ef578..7b31bbbd85 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Set_Suspend_OnTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Basal_Set_Suspend_OnTest : DanaRSTestBase() { +class DanaRsPacketBasalSetSuspendOnTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_OptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt similarity index 93% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_OptionTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt index b5de343b51..23ed112982 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_OptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt @@ -3,6 +3,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -11,7 +12,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(RxBusWrapper::class) -class DanaRS_Packet_Bolus_Get_Bolus_OptionTest : DanaRSTestBase() { +class DanaRsPacketBolusGetBolusOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt similarity index 86% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt index 1149a2fccf..a8b887ba45 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Bolus_Get_Calculation_InformationTest : DanaRSTestBase() { +class DanaRsPacketBolusGetCalculationInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCarbohydrateCalculationInformationTest.kt similarity index 86% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCarbohydrateCalculationInformationTest.kt index fae26a11ae..9a5627c42c 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCarbohydrateCalculationInformationTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest : DanaRSTestBase() { +class DanaRsPacketBolusGetCarbohydrateCalculationInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt index 04afc60cf6..b56e1a5426 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt @@ -3,13 +3,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.dana.DanaPump +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest : DanaRSTestBase() { +class DanaRsPacketBolusGetCirCfArrayTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_BolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetDualBolusTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_BolusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetDualBolusTest.kt index 3af180017f..5f04609ec5 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_BolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetDualBolusTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Get_Dual_BolusTest : DanaRSTestBase() { +class DanaRsPacketBolusGetDualBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusStateTest.kt similarity index 79% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusStateTest.kt index 093ccbfa0c..c74b203ff5 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusStateTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest : DanaRSTestBase() { +class DanaRsPacketBolusGetExtendedBolusStateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -27,10 +26,10 @@ class DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest : DanaRSTestBase() { Assert.assertEquals(null, packet.requestParams) // test message decoding var testValue = 0.0 - packet.handleMessage(createArray(11, testValue.toByte())) + packet.handleMessage(createArray(11, testValue.toInt().toByte())) Assert.assertEquals(testValue != 0.0, packet.failed) testValue = 1.0 - packet.handleMessage(createArray(11, testValue.toByte())) + packet.handleMessage(createArray(11, testValue.toInt().toByte())) // is extended bolus in progress Assert.assertEquals(testValue == 1.0, danaPump.isExtendedInProgress) Assert.assertEquals(testValue != 0.0, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusTest.kt similarity index 77% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusTest.kt index 5f89ad8a8e..4da5e4ea6c 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedBolusTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Bolus_Get_Extended_BolusTest : DanaRSTestBase() { +class DanaRsPacketBolusGetExtendedBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -27,11 +26,11 @@ class DanaRS_Packet_Bolus_Get_Extended_BolusTest : DanaRSTestBase() { Assert.assertEquals(null, packet.requestParams) // test message decoding var testValue = 0.0 - packet.handleMessage(createArray(10, testValue.toByte())) + packet.handleMessage(createArray(10, testValue.toInt().toByte())) Assert.assertEquals(testValue != 0.0, packet.failed) testValue = 1.0 - packet.handleMessage(createArray(10, testValue.toByte())) - // is pump.bolustep set to 1 + packet.handleMessage(createArray(10, testValue.toInt().toByte())) + // is pump.bolusStep set to 1 Assert.assertEquals(testValue / 100.0, danaPump.bolusStep, 0.0) Assert.assertEquals(testValue != 0.0, packet.failed) Assert.assertEquals("BOLUS__GET_EXTENDED_BOLUS", packet.friendlyName) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedMenuOptionStateTest.kt similarity index 86% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedMenuOptionStateTest.kt index 550273e68d..db66481f5a 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetExtendedMenuOptionStateTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest : DanaRSTestBase() { +class DanaRsPacketBolusGetExtendedMenuOptionStateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -24,7 +25,7 @@ class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest : DanaRSTestBase() Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) - // isExtendedinprogres should be false + // isExtendedInProgress should be false Assert.assertEquals(false, danaPump.isExtendedInProgress) // assertEquals(false, packet.failed); packet.handleMessage(createArray(34, 1.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetInitialBolusTest.kt similarity index 84% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetInitialBolusTest.kt index 0bd7db33a3..883205431c 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetInitialBolusTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Get_Initial_BolusTest : DanaRSTestBase() { +class DanaRsPacketBolusGetInitialBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -23,7 +24,7 @@ class DanaRS_Packet_Bolus_Get_Initial_BolusTest : DanaRSTestBase() { Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) - // should fail only if all the initialbolusses are 0 + // should fail only if all the initial boluses are 0 Assert.assertEquals(false, !packet.failed) packet.handleMessage(createArray(34, 1.toByte())) Assert.assertEquals(true, !packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt similarity index 82% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt index 66df970476..b1e4721db8 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt @@ -2,16 +2,15 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner import java.util.* @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() { +class DanaRsPacketBolusGetStepBolusInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -41,9 +40,10 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() { packet.handleMessage(array) Assert.assertTrue(packet.failed) Assert.assertEquals(6.0, danaPump.initialBolusAmount, 0.01) - val lastBolus = Date(danaPump.lastBolusTime) - Assert.assertEquals(13, lastBolus.hours) - Assert.assertEquals(20, lastBolus.minutes) + val lastBolus = Calendar.getInstance() + lastBolus.timeInMillis = danaPump.lastBolusTime + Assert.assertEquals(13, lastBolus.get(Calendar.HOUR_OF_DAY)) + Assert.assertEquals(20, lastBolus.get(Calendar.MINUTE)) Assert.assertEquals(12.5, danaPump.lastBolusAmount, 0.01) Assert.assertEquals(25.0, danaPump.maxBolus, 0.01) Assert.assertEquals(1.0, danaPump.bolusStep, 0.01) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Bolus_OptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt similarity index 81% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Bolus_OptionTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt index 7fa66dbe43..450e0d17f8 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Bolus_OptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Set_Bolus_OptionTest : DanaRSTestBase() { +class DanaRsPacketBolusSetBolusOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -21,9 +22,9 @@ class DanaRS_Packet_Bolus_Set_Bolus_OptionTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Set_Bolus_Option(packetInjector, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) // test params - val testparams = packet.requestParams - Assert.assertEquals(0.toByte(), testparams[0]) - Assert.assertEquals(0.toByte(), testparams[18]) + val testParams = packet.requestParams + Assert.assertEquals(0.toByte(), testParams[0]) + Assert.assertEquals(0.toByte(), testParams[18]) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) // DanaRPump testPump = DanaRPump.getInstance(); diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetCirCfArrayTest.kt similarity index 81% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetCirCfArrayTest.kt index 925dd1731b..2987a11fb0 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetCirCfArrayTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest : DanaRSTestBase() { +class DanaRsPacketBolusSetCirCfArrayTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -21,9 +22,9 @@ class DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Set_CIR_CF_Array(packetInjector, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) // test params - val testparams = packet.requestParams - Assert.assertEquals(0.toByte(), testparams[0]) - Assert.assertEquals(0.toByte(), testparams[18]) + val testParams = packet.requestParams + Assert.assertEquals(0.toByte(), testParams[0]) + Assert.assertEquals(0.toByte(), testParams[18]) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) // DanaRPump testPump = DanaRPump.getInstance(); diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Dual_BolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetDualBolusTest.kt similarity index 81% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Dual_BolusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetDualBolusTest.kt index 5ae468084e..bd15873509 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Dual_BolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetDualBolusTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Set_Dual_BolusTest : DanaRSTestBase() { +class DanaRsPacketBolusSetDualBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -21,9 +22,9 @@ class DanaRS_Packet_Bolus_Set_Dual_BolusTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Set_Dual_Bolus(packetInjector, 0.0, 0.0, 1) // test params - val testparams = packet.requestParams - Assert.assertEquals(0.toByte(), testparams[0]) - Assert.assertEquals(1.toByte(), testparams[4]) + val testParams = packet.requestParams + Assert.assertEquals(0.toByte(), testParams[0]) + Assert.assertEquals(1.toByte(), testParams[4]) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) // DanaRPump testPump = DanaRPump.getInstance(); diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt similarity index 88% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt index 3d836828d9..02893dc262 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest : DanaRSTestBase() { +class DanaRsPacketBolusSetExtendedBolusCancelTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_BolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_BolusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt index aa3eb950d6..055bbf3582 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Extended_BolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Set_Extended_BolusTest : DanaRSTestBase() { +class DanaRsPacketBolusSetExtendedBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Initial_BolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetInitialBolusTest.kt similarity index 77% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Initial_BolusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetInitialBolusTest.kt index dee94531fc..f3510221ff 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Initial_BolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetInitialBolusTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Bolus_Set_Initial_BolusTest : DanaRSTestBase() { +class DanaRsPacketBolusSetInitialBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -21,9 +22,9 @@ class DanaRS_Packet_Bolus_Set_Initial_BolusTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Set_Initial_Bolus(packetInjector, 0, 0, 0, 100) // test params - val testparams = packet.requestParams - Assert.assertEquals(0.toByte(), testparams[0]) - Assert.assertEquals(100.toByte(), testparams[6]) + val testParams = packet.requestParams + Assert.assertEquals(0.toByte(), testParams[0]) + Assert.assertEquals(100.toByte(), testParams[6]) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt index e97af48150..95b95df7a7 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt @@ -4,6 +4,7 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker @@ -19,7 +20,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class) -class DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest : DanaRSTestBase() { +class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() { @Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var commandQueue: CommandQueueProvider @@ -41,9 +42,9 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Set_Step_Bolus_Start(packetInjector) // test params - val testparams = packet.requestParams - Assert.assertEquals(0.toByte(), testparams[0]) - Assert.assertEquals(0.toByte(), testparams[2]) + val testParams = packet.requestParams + Assert.assertEquals(0.toByte(), testParams[0]) + Assert.assertEquals(0.toByte(), testParams[2]) // test message decoding packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt similarity index 94% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt index b7a4238bd6..2de51051ff 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt @@ -2,10 +2,11 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSPlugin +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.danars.DanaRSPlugin import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -17,7 +18,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(RxBusWrapper::class, DanaRSPlugin::class) -class DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest : DanaRSTestBase() { +class DanaRsPacketBolusSetStepBolusStopTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePluginProvider diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt similarity index 90% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt index 8316314b5e..ecc02cc85b 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Etc_Keep_ConnectionTest : DanaRSTestBase() { +class DanaRsPacketEtcKeepConnectionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Set_History_SaveTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt similarity index 75% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Set_History_SaveTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt index e69ff881fb..a239281ad3 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Etc_Set_History_SaveTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Etc_Set_History_SaveTest : DanaRSTestBase() { +class DanaRsPacketEtcSetHistorySaveTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -23,9 +22,9 @@ class DanaRS_Packet_Etc_Set_History_SaveTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Etc_Set_History_Save(packetInjector, 0, 0, 0, 0, 0, 0, 0, 0, 2) // test params - val testparams = packet.requestParams - Assert.assertEquals(2.toByte(), testparams[8]) - Assert.assertEquals((2 ushr 8).toByte(), testparams[9]) + val testParams = packet.requestParams + Assert.assertEquals(2.toByte(), testParams[8]) + Assert.assertEquals((2 ushr 8).toByte(), testParams[9]) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Delivery_StatusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralDeliveryStatusTest.kt similarity index 86% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Delivery_StatusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralDeliveryStatusTest.kt index 03f46ecb5b..c1a758daee 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Delivery_StatusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralDeliveryStatusTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_General_Delivery_StatusTest : DanaRSTestBase() { +class DanaRsPacketGeneralDeliveryStatusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_InformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetMoreInformationTest.kt similarity index 81% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_InformationTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetMoreInformationTest.kt index 61aa3e632c..f21ae1b563 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_InformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetMoreInformationTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner import java.util.* @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetMoreInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -37,7 +38,7 @@ class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() { putIntToArray(array, 5, 150) // extended remaining minutes 150 putByteToArray(array, 9, 15) // hours 15 putByteToArray(array, 10, 25) // minutes 25 - putIntToArray(array, 11, 170) // last bolus manout 1.70 + putIntToArray(array, 11, 170) // last bolus amount 1.70 packet.handleMessage(array) Assert.assertFalse(packet.failed) @@ -45,9 +46,10 @@ class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() { Assert.assertEquals(12.5, danaPump.dailyTotalUnits, 0.01) Assert.assertTrue(danaPump.isExtendedInProgress) Assert.assertEquals(150, danaPump.extendedBolusRemainingMinutes) - val lastBolus = Date(danaPump.lastBolusTime) - Assert.assertEquals(15, lastBolus.hours) - Assert.assertEquals(25, lastBolus.minutes) + val lastBolus = Calendar.getInstance() + lastBolus.timeInMillis = danaPump.lastBolusTime + Assert.assertEquals(15, lastBolus.get(Calendar.HOUR_OF_DAY)) + Assert.assertEquals(25, lastBolus.get(Calendar.MINUTE)) Assert.assertEquals(1.7, danaPump.lastBolusAmount, 0.01) Assert.assertEquals("REVIEW__GET_MORE_INFORMATION", packet.friendlyName) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_PasswordTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPasswordTest.kt similarity index 90% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_PasswordTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPasswordTest.kt index 6968c7eff1..9fe3e2a8ec 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_PasswordTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPasswordTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Get_PasswordTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetPasswordTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt similarity index 92% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt index 5994d2d5d0..b3c7b5df8f 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Assert import org.junit.Test @@ -11,7 +12,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(RxBusWrapper::class) -class DanaRS_Packet_General_Get_Pump_CheckTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetPumpCheckTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt similarity index 90% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt index 21716b37c8..07201595db 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Get_Shipping_InformationTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetShippingInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_VerisonTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_VerisonTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt index e66dea3dad..3a63508855 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_VerisonTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Get_Shipping_VerisonTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetShippingVerisonTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetTodayDeliveryTotalTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetTodayDeliveryTotalTest.kt index bcb6c0987d..4497e3dc90 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetTodayDeliveryTotalTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Get_Today_Delivery_TotalTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetTodayDeliveryTotalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt index 69cada9822..0f901ca6e8 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Get_User_Time_Change_FlagTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetUserTimeChangeFlagTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt similarity index 90% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt index 60a8a6d74d..a67535ea5e 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Initial_Screen_InformationTest : DanaRSTestBase() { +class DanaRsPacketGeneralInitialScreenInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_History_Upload_ModeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_History_Upload_ModeTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt index 4e88396e27..4a2061bce1 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_History_Upload_ModeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Set_History_Upload_ModeTest : DanaRSTestBase() { +class DanaRsPacketGeneralSetHistoryUploadModeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_User_Time_Change_Flag_ClearTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_User_Time_Change_Flag_ClearTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt index 20b312641a..2e6e170be5 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Set_User_Time_Change_Flag_ClearTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_General_Set_User_Time_Change_Flag_ClearTest : DanaRSTestBase() { +class DanaRsPacketGeneralSetUserTimeChangeFlagClearTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_All_HistoryTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_All_HistoryTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt index 8e2558f0e2..8135997298 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_All_HistoryTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_All_HistoryTest : DanaRSTestBase() { +class DanaRsPacketHistoryAllHistoryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BasalTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt index f0ab651b9e..1d0f7f978d 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_BasalTest : DanaRSTestBase() { +class DanaRsPacketHistoryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt index df83c63baa..683298ff8b 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_Blood_GlucoseTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_Blood_GlucoseTest : DanaRSTestBase() { +class DanaRsPacketHistoryBloodGlucoseTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BolusTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt index e2bc27ae88..94b8f19777 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_BolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_BolusTest : DanaRSTestBase() { +class DanaRsPacketHistoryBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_CarbohydrateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_CarbohydrateTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt index 6a9aa52189..cfa447fa89 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_CarbohydrateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_CarbohydrateTest : DanaRSTestBase() { +class DanaRsPacketHistoryCarbohydrateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_DailyTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_DailyTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt index 85719ce40d..a98894c6e7 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_DailyTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_DailyTest : DanaRSTestBase() { +class DanaRsPacketHistoryDailyTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_PrimeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_PrimeTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt index f06f0605b9..a651910802 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_PrimeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_PrimeTest : DanaRSTestBase() { +class DanaRsPacketHistoryPrimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_RefillTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_RefillTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt index fcbc0a182c..65d484aa77 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_RefillTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_RefillTest : DanaRSTestBase() { +class DanaRsPacketHistoryRefillTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_SuspendTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_SuspendTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt index e6de597869..04fba763ee 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_SuspendTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_SuspendTest : DanaRSTestBase() { +class DanaRsPacketHistorySuspendTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_TemporaryTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_TemporaryTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt index 9064a8d3b4..c8eed86284 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_History_TemporaryTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_History_TemporaryTest : DanaRSTestBase() { +class DanaRsPacketHistoryTemporaryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_AlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt similarity index 75% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_AlarmTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt index 04df7d84f9..0abdb1606a 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_AlarmTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt @@ -2,19 +2,16 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import org.junit.Assert -import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(NSUpload::class) -class DanaRS_Packet_Notify_AlarmTest : DanaRSTestBase() { +class DanaRsPacketNotifyAlarmTest : DanaRSTestBase() { @Mock lateinit var nsUpload: NSUpload @@ -34,7 +31,7 @@ class DanaRS_Packet_Notify_AlarmTest : DanaRSTestBase() { // test params Assert.assertEquals(null, packet.requestParams) // test message decoding -// handlemessage testing fails on non-eror byte because of NSUpload not properly mocked + // handle message testing fails on non-error byte because of NSUpload not properly mocked packet.handleMessage(createArray(17, 0x01.toByte())) Assert.assertEquals(false, packet.failed) // no error @@ -42,9 +39,4 @@ class DanaRS_Packet_Notify_AlarmTest : DanaRSTestBase() { Assert.assertEquals(true, packet.failed) Assert.assertEquals("NOTIFY__ALARM", packet.friendlyName) } - - @Before - fun mock() { - PowerMockito.mockStatic(NSUpload::class.java) - } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index 104ba1d13a..18db110e5b 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_DisplayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -3,8 +3,8 @@ package info.nightscout.androidaps.danars.comm import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.Config import info.nightscout.androidaps.danars.DanaRSPlugin +import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider @@ -23,7 +23,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(ConstraintChecker::class, RxBusWrapper::class, DetailedBolusInfoStorage::class) -class DanaRS_Packet_Notify_Delivery_Rate_DisplayTest : DanaRSTestBase() { +class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePluginProvider @Mock lateinit var constraintChecker: ConstraintChecker @@ -68,7 +68,7 @@ class DanaRS_Packet_Notify_Delivery_Rate_DisplayTest : DanaRSTestBase() { @Before fun mock() { - danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) + danaRSPlugin = DanaRSPlugin(packetInjector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil) danaPump.bolusingTreatment = Treatment(packetInjector) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Missed_Bolus_AlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt similarity index 89% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Missed_Bolus_AlarmTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt index 164720f011..0a25ea13e9 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Missed_Bolus_AlarmTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Notify_Missed_Bolus_AlarmTest : DanaRSTestBase() { +class DanaRsPacketNotifyMissedBolusAlarmTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt index 3a1a8e1256..5efaeb9812 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_TimeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.joda.time.DateTime import org.junit.Assert import org.junit.Test @@ -9,7 +10,7 @@ import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Option_Get_Pump_TimeTest : DanaRSTestBase() { +class DanaRsPacketOptionGetPumpTimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_OptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt similarity index 90% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_OptionTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt index 8f5f8f0309..fb55d3c58b 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_OptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Option_Get_User_OptionTest : DanaRSTestBase() { +class DanaRsPacketOptionGetUserOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt similarity index 60% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt index b67447884e..2b39688f61 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_Pump_TimeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt @@ -2,14 +2,15 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase +import org.joda.time.DateTime import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner -import java.util.* @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Option_Set_Pump_TimeTest : DanaRSTestBase() { +class DanaRsPacketOptionSetPumpTimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { @@ -17,22 +18,20 @@ class DanaRS_Packet_Option_Set_Pump_TimeTest : DanaRSTestBase() { it.aapsLogger = aapsLogger it.dateUtil = dateUtil } - if (it is DanaRS_Packet_Option_Set_Pump_Time) { - } } } @Test fun runTest() { - val date = Date() - val packet = DanaRS_Packet_Option_Set_Pump_Time(packetInjector, date.time) + val date = DateTime() + val packet = DanaRS_Packet_Option_Set_Pump_Time(packetInjector, date.millis) // test params val params = packet.requestParams - Assert.assertEquals((date.year - 100 and 0xff).toByte(), params[0]) // 2019 -> 19 - Assert.assertEquals((date.month + 1 and 0xff).toByte(), params[1]) - Assert.assertEquals((date.date and 0xff).toByte(), params[2]) - Assert.assertEquals((date.hours and 0xff).toByte(), params[3]) - Assert.assertEquals((date.minutes and 0xff).toByte(), params[4]) - Assert.assertEquals((date.seconds and 0xff).toByte(), params[5]) + Assert.assertEquals((date.year - 2000 and 0xff).toByte(), params[0]) // 2019 -> 19 + Assert.assertEquals((date.monthOfYear and 0xff).toByte(), params[1]) + Assert.assertEquals((date.dayOfMonth and 0xff).toByte(), params[2]) + Assert.assertEquals((date.hourOfDay and 0xff).toByte(), params[3]) + Assert.assertEquals((date.minuteOfHour and 0xff).toByte(), params[4]) + Assert.assertEquals((date.secondOfMinute and 0xff).toByte(), params[5]) // test message decoding packet.handleMessage(createArray(3, 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Bolus_AvgTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Bolus_AvgTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt index 5b5e179f7d..c4b7219a41 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Bolus_AvgTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt @@ -2,15 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest() -class DanaRS_Packet_Review_Bolus_AvgTest : DanaRSTestBase() { +class DanaRsPacketReviewBolusAvgTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_RatioTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt similarity index 88% rename from app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_RatioTest.kt rename to danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt index 9c04fdf0c1..43c56c9496 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_RatioTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt @@ -2,13 +2,14 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class DanaRS_Packet_Review_Get_Pump_Dec_RatioTest : DanaRSTestBase() { +class DanaRsPacketReviewGetPumpDecRatioTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector {