From 7de42fe282743c80f49876a2d28871bca452e13b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 29 Nov 2022 15:03:25 +0100 Subject: [PATCH] migrate to junit5 --- .../info/nightscout/shared/SafeParseTest.kt | 2 +- .../info/nightscout/androidaps/TestBase.kt | 20 ++++--- .../androidaps/TestBaseWithProfile.kt | 4 +- .../androidaps/data/QuickWizardTest.kt | 6 +-- .../interfaces/ConstraintsCheckerTest.kt | 8 +-- .../plugins/aps/loop/LoopPluginTest.kt | 12 ++--- .../configBuilder/ConfigBuilderPluginTest.kt | 8 +-- .../maintenance/MaintenancePluginTest.kt | 6 +-- .../plugins/safety/SafetyPluginTest.kt | 6 +-- .../AbstractSensitivityPluginTest.kt | 2 +- .../androidaps/pump/PumpEnactResultTest.kt | 6 +-- build.gradle | 7 +-- .../iobCobCalculator/GlucoseStatusProvider.kt | 2 + .../info/nightscout/androidaps/TestBase.kt | 16 +++--- .../androidaps/TestBaseWithProfile.kt | 4 +- .../androidaps/data/ConstraintTest.kt | 6 +-- .../androidaps/data/DetailedBolusInfoTest.kt | 2 +- .../nightscout/androidaps/data/IobTest.kt | 2 +- .../androidaps/data/IobTotalTest.kt | 6 +-- .../androidaps/data/MealDataTest.kt | 2 +- .../nightscout/androidaps/data/ProfileTest.kt | 8 +-- .../extensions/BlockExtensionKtTest.kt | 2 +- .../interfaces/PluginDescriptionTest.kt | 2 +- .../androidaps/interfaces/ProfileStoreTest.kt | 2 +- .../interfaces/PumpDescriptionTest.kt | 2 +- .../plugins/aps/loop/APSResultTest.kt | 6 +-- .../iob/iobCalculator/GlucoseStatusTest.kt | 10 ++-- .../iobCobCalculator/AutosensDataStoreTest.kt | 6 +-- .../pump/common/utils/DateTimeUtilUTest.java | 2 +- .../androidaps/utils/CryptoUtilTest.kt | 2 +- .../androidaps/utils/DateUtilTest.kt | 4 +- .../androidaps/utils/DecimalFormatterTest.kt | 2 +- .../androidaps/utils/JsonHelperTest.kt | 2 +- .../androidaps/utils/MidnightTimeTest.kt | 4 +- .../nightscout/androidaps/utils/RoundTest.kt | 2 +- .../androidaps/utils/StringUtilsTest.kt | 2 +- .../info/nightscout/androidaps/utils/TTest.kt | 2 +- .../nightscout/core/wizard/BolusWizardTest.kt | 2 +- core/core-main/test_dependencies.gradle | 12 +++-- .../interfaces/plugin/PluginBase.kt | 4 +- .../nightscout/interfaces/utils/TimerUtil.kt | 4 +- .../validators/ExampleInstrumentedTest.kt | 23 -------- .../core/validators/ExampleUnitTest.kt | 17 ------ .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../androidaps/TestBaseWithProfile.kt | 4 +- .../nightscout/androidaps/TestPumpPlugin.kt | 2 + .../implementation/BolusTimerImplTest.kt | 6 +-- .../implementation/CarbTimerImplTest.kt | 12 +++-- .../pump/DetailedBolusInfoStorageTest.kt | 6 +-- .../pump/TemporaryBasalStorageTest.kt | 7 ++- .../queue/CommandQueueImplementationTest.kt | 6 +-- .../implementation/queue/QueueThreadTest.kt | 6 +-- .../plugins/general/autotune/AutotuneFS.kt | 2 + .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../androidaps/TestBaseWithProfile.kt | 4 +- .../general/autotune/AutotuneCoreTest.kt | 6 +-- .../general/autotune/AutotunePrepTest.kt | 6 +-- .../general/autotune/PreppedGlucoseTest.kt | 16 +++--- .../services/LocationServiceHelper.kt | 2 + .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../androidaps/TestBaseWithProfile.kt | 4 +- .../automation/AutomationEventTest.kt | 2 +- .../automation/ComposeTriggerTest.kt | 2 +- .../automation/actions/ActionAlarmTest.kt | 11 ++-- .../actions/ActionCarePortalEventTest.kt | 12 ++--- .../automation/actions/ActionDummyTest.kt | 2 +- .../actions/ActionLoopDisableTest.kt | 6 +-- .../actions/ActionLoopEnableTest.kt | 6 +-- .../actions/ActionLoopResumeTest.kt | 6 +-- .../actions/ActionLoopSuspendTest.kt | 6 +-- .../actions/ActionNotificationTest.kt | 6 +-- .../actions/ActionProfileSwitchPercentTest.kt | 8 +-- .../actions/ActionProfileSwitchTest.kt | 6 +-- .../automation/actions/ActionSendSMSTest.kt | 8 +-- .../actions/ActionStartTempTargetTest.kt | 10 ++-- .../actions/ActionStopProcessingTest.kt | 8 +-- .../actions/ActionStopTempTargetTest.kt | 10 ++-- .../automation/actions/ActionsTestBase.kt | 8 +-- .../elements/ComparatorConnectTest.kt | 2 +- .../elements/ComparatorExistsTest.kt | 2 +- .../automation/elements/ComparatorTest.kt | 2 +- .../automation/elements/InputBgTest.kt | 8 +-- .../elements/InputCarePortalEventTest.kt | 2 +- .../automation/elements/InputDurationTest.kt | 2 +- .../automation/elements/InputInsulinTest.kt | 2 +- .../automation/elements/InputPercentTest.kt | 2 +- .../elements/InputProfileNameTest.kt | 2 +- .../automation/elements/InputStringTest.kt | 2 +- .../elements/InputTempTargetTest.kt | 4 +- .../elements/LabelWithElementTest.kt | 2 +- .../automation/elements/LayoutBuilderTest.kt | 2 +- .../automation/elements/StaticLabelTest.kt | 2 +- .../triggers/TriggerAutosensValueTest.kt | 8 +-- .../triggers/TriggerBTDeviceTest.kt | 2 +- .../automation/triggers/TriggerBgTest.kt | 6 +-- .../triggers/TriggerBolusAgoTest.kt | 6 +-- .../automation/triggers/TriggerCOBTest.kt | 6 +-- .../triggers/TriggerConnectorTest.kt | 2 +- .../automation/triggers/TriggerDeltaTest.kt | 6 +-- .../automation/triggers/TriggerDummyTest.kt | 2 +- .../automation/triggers/TriggerIobTest.kt | 6 +-- .../triggers/TriggerLocationTest.kt | 6 +-- .../triggers/TriggerProfilePercentTest.kt | 6 +-- .../triggers/TriggerPumpLastConnectionTest.kt | 6 +-- .../triggers/TriggerRecurringTimeTest.kt | 6 +-- .../triggers/TriggerTempTargetTest.kt | 6 +-- .../triggers/TriggerTempTargetValueTest.kt | 6 +-- .../automation/triggers/TriggerTestBase.kt | 8 +-- .../triggers/TriggerTimeRangeTest.kt | 8 +-- .../automation/triggers/TriggerTimeTest.kt | 6 +-- .../triggers/TriggerWifiSsidTest.kt | 7 +-- .../info/nightscout/androidaps/TestBase.kt | 14 +++-- .../formats/EncryptedPrefsFormatTest.kt | 53 ++++++++++--------- .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../androidaps/TestBaseWithProfile.kt | 4 +- .../nightscout/androidaps/TestPumpPlugin.kt | 2 + .../objectives/ObjectivesPluginTest.kt | 6 +-- .../constraints/objectives/SntpClientTest.kt | 2 +- .../smsCommunicator/AuthRequestTest.kt | 6 +-- .../general/smsCommunicator/SmsActionTest.kt | 2 +- .../SmsCommunicatorPluginTest.kt | 6 +-- .../general/smsCommunicator/SmsTest.kt | 2 +- .../insulin/InsulinLyumjevPluginTest.kt | 18 +++---- .../insulin/InsulinOrefBasePluginTest.kt | 18 +++---- .../insulin/InsulinOrefFreePeakPluginTest.kt | 6 +-- .../InsulinOrefRapidActingPluginTest.kt | 18 +++---- .../InsulinOrefUltraRapidActingPluginTest.kt | 18 +++---- .../pump/virtual/VirtualPumpPluginUTest.kt | 6 +-- .../plugins/source/GlimpPluginTest.kt | 6 +-- .../plugins/source/MM640GPluginTest.kt | 6 +-- .../plugins/source/NSClientPluginTest.kt | 7 ++- .../plugins/source/XdripPluginTest.kt | 6 +-- .../info/nightscout/androidaps/TestBase.kt | 14 +++-- .../BgQualityCheckPluginTest.kt | 6 +-- .../dstHelper/DstHelperPluginTest.kt | 8 +-- .../SignatureVerifierPluginTest.kt | 2 +- .../VersionCheckerUtilsKtTest.kt | 10 ++-- .../storage/StorageConstraintPluginTest.kt | 6 +-- .../versionChecker/AllowedVersionsTest.kt | 2 +- .../info/nightscout/androidaps/TestBase.kt | 14 +++-- .../nsclient/NsClientReceiverDelegateTest.kt | 6 +-- .../plugins/sync/tidepool/comm/SessionTest.kt | 2 +- .../nightscout/pump/combo/ComboPluginTest.kt | 6 +-- .../info/nightscout/pump/combo/TestBase.kt | 18 +++---- .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../androidaps/TestBaseWithProfile.kt | 4 +- .../androidaps/dana/DanaPumpTest.kt | 6 +-- .../danaRKorean/DanaRKoreanPlugin.kt | 2 + .../androidaps/danaRv2/DanaRv2Plugin.java | 2 + .../androidaps/danar/DanaRPlugin.java | 2 + .../info/nightscout/androidaps/TestBase.kt | 20 ++++--- .../androidaps/TestBaseWithProfile.kt | 4 +- .../plugins/pump/danaR/DanaRPluginTest.kt | 6 +-- .../plugins/pump/danaR/comm/DanaRTestBase.kt | 8 +-- .../pump/danaR/comm/MessageHashTableRTest.kt | 2 +- .../danaR/comm/MessageOriginalNamesTest.kt | 2 +- .../pump/danaR/comm/MsgBolusProgressTest.kt | 2 +- .../pump/danaR/comm/MsgBolusStartTest.kt | 2 +- .../danaR/comm/MsgBolusStartWithSpeedTest.kt | 2 +- .../pump/danaR/comm/MsgBolusStopTest.kt | 2 +- .../pump/danaR/comm/MsgCheckValueTest.kt | 2 +- .../plugins/pump/danaR/comm/MsgErrorTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryAlarmTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryAllDoneTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryAllTest.kt | 2 +- .../danaR/comm/MsgHistoryBasalHourTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryBolusTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryCarboTest.kt | 2 +- .../danaR/comm/MsgHistoryDailyInsulinTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryDoneTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryErrorTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryGlucoseTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryNewDoneTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryNewTest.kt | 2 +- .../pump/danaR/comm/MsgHistoryRefillTest.kt | 2 +- .../pump/danaR/comm/MsgHistorySuspendTest.kt | 2 +- .../danaR/comm/MsgInitConnStatusBasicTest.kt | 2 +- .../danaR/comm/MsgInitConnStatusBolusTest.kt | 2 +- .../danaR/comm/MsgInitConnStatusOptionTest.kt | 2 +- .../danaR/comm/MsgInitConnStatusTimeTest.kt | 2 +- .../pump/danaR/comm/MsgPCCommStartTest.kt | 2 +- .../pump/danaR/comm/MsgPCCommStopTest.kt | 2 +- .../comm/MsgSetActivateBasalProfileTest.kt | 2 +- .../pump/danaR/comm/MsgSetBasalProfileTest.kt | 2 +- .../pump/danaR/comm/MsgSetCarbsEntryTest.kt | 2 +- .../comm/MsgSetExtendedBolusStartTest.kt | 2 +- .../danaR/comm/MsgSetExtendedBolusStopTest.kt | 2 +- .../comm/MsgSetSingleBasalProfileTest.kt | 2 +- .../danaR/comm/MsgSetTempBasalStartTest.kt | 2 +- .../plugins/pump/danaR/comm/MsgSetTimeTest.kt | 2 +- .../pump/danaR/comm/MsgSetUserOptionsTest.kt | 2 +- .../danaR/comm/MsgSettingActiveProfileTest.kt | 2 +- .../comm/MsgSettingBasalProfileAllTest.kt | 2 +- .../pump/danaR/comm/MsgSettingBasalTest.kt | 2 +- .../pump/danaR/comm/MsgSettingGlucoseTest.kt | 2 +- .../danaR/comm/MsgSettingMaxValuesTest.kt | 2 +- .../pump/danaR/comm/MsgSettingMealTest.kt | 2 +- .../comm/MsgSettingProfileRatiosAllTest.kt | 2 +- .../danaR/comm/MsgSettingProfileRatiosTest.kt | 2 +- .../pump/danaR/comm/MsgSettingPumpTimeTest.kt | 2 +- .../danaR/comm/MsgSettingShippingInfoTest.kt | 2 +- .../danaR/comm/MsgSettingUserOptionsTest.kt | 2 +- .../pump/danaR/comm/MsgStatusBasicTest.kt | 2 +- .../danaR/comm/MsgStatusBolusExtendedTest.kt | 2 +- .../pump/danaR/comm/MsgStatusProfileTest.kt | 2 +- .../pump/danaR/comm/MsgStatusTempBasalTest.kt | 2 +- .../plugins/pump/danaR/comm/MsgStatusTest.kt | 2 +- .../pump/danaR/comm/RecordTypesTest.kt | 2 +- .../pump/danaRKorean/DanaRKoreanPluginTest.kt | 6 +-- .../comm/MessageHashTableRKoreanTest.kt | 2 +- .../plugins/pump/danaRv2/DanaRv2PluginTest.kt | 6 +-- .../danaRv2/comm/MessageHashTableRv2Test.kt | 2 +- .../pump/danaRv2/comm/MsgCheckValueRv2Test.kt | 2 +- .../danaRv2/comm/MsgHistoryEventsRv2Test.kt | 2 +- .../comm/MsgSetAPSTempBasalStartRv2Test.kt | 2 +- .../danaRv2/comm/MsgSetHistoryEntryRv2Test.kt | 2 +- .../pump/danaRv2/comm/MsgStatusAPSRv2Test.kt | 2 +- .../nightscout/androidaps/utils/CRCTest.kt | 2 +- .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../androidaps/TestBaseWithProfile.kt | 4 +- .../pump/danars/DanaRSPluginTest.kt | 6 +-- .../nightscout/pump/danars/DanaRSTestBase.kt | 6 +-- .../DanaRSPacketBasalSetTemporaryBasalTest.kt | 2 +- .../comm/DanaRSPacketHistoryAlarmTest.kt | 2 +- .../DanaRSPacketNotifyDeliveryCompleteTest.kt | 2 +- .../DanaRSPacketOptionSetUserOptionTest.kt | 2 +- .../danars/comm/DanaRsMessageHashTableTest.kt | 2 +- ...naRsPacketApsBasalSetTemporaryBasalTest.kt | 2 +- .../comm/DanaRsPacketApsHistoryEventsTest.kt | 2 +- .../DanaRsPacketApsSetEventHistoryTest.kt | 2 +- .../comm/DanaRsPacketBasalGetBasalRateTest.kt | 2 +- .../DanaRsPacketBasalGetProfileNumberTest.kt | 2 +- ...sPacketBasalSetCancelTemporaryBasalTest.kt | 2 +- ...anaRsPacketBasalSetProfileBasalRateTest.kt | 2 +- .../DanaRsPacketBasalSetProfileNumberTest.kt | 2 +- .../DanaRsPacketBasalSetSuspendOffTest.kt | 2 +- .../comm/DanaRsPacketBasalSetSuspendOnTest.kt | 2 +- .../DanaRsPacketBolusGetBolusOptionTest.kt | 2 +- ...acketBolusGetCalculationInformationTest.kt | 2 +- .../DanaRsPacketBolusGetCirCfArrayTest.kt | 2 +- ...sPacketBolusGetStepBolusInformationTest.kt | 5 +- .../DanaRsPacketBolusSetBolusOptionTest.kt | 2 +- ...RsPacketBolusSetExtendedBolusCancelTest.kt | 2 +- .../DanaRsPacketBolusSetExtendedBolusTest.kt | 2 +- .../DanaRsPacketBolusSetStepBolusStartTest.kt | 6 +-- .../DanaRsPacketBolusSetStepBolusStopTest.kt | 2 +- .../comm/DanaRsPacketEtcKeepConnectionTest.kt | 2 +- .../comm/DanaRsPacketEtcSetHistorySaveTest.kt | 2 +- .../DanaRsPacketGeneralGetPumpCheckTest.kt | 2 +- ...PacketGeneralGetShippingInformationTest.kt | 2 +- ...naRsPacketGeneralGetShippingVerisonTest.kt | 2 +- ...sPacketGeneralGetUserTimeChangeFlagTest.kt | 2 +- ...cketGeneralInitialScreenInformationTest.kt | 2 +- ...RsPacketGeneralSetHistoryUploadModeTest.kt | 2 +- ...etGeneralSetUserTimeChangeFlagClearTest.kt | 2 +- .../comm/DanaRsPacketHistoryAllHistoryTest.kt | 2 +- .../comm/DanaRsPacketHistoryBasalTest.kt | 2 +- .../DanaRsPacketHistoryBloodGlucoseTest.kt | 2 +- .../comm/DanaRsPacketHistoryBolusTest.kt | 2 +- .../DanaRsPacketHistoryCarbohydrateTest.kt | 2 +- .../comm/DanaRsPacketHistoryDailyTest.kt | 2 +- .../comm/DanaRsPacketHistoryPrimeTest.kt | 2 +- .../comm/DanaRsPacketHistoryRefillTest.kt | 2 +- .../comm/DanaRsPacketHistorySuspendTest.kt | 2 +- .../comm/DanaRsPacketHistoryTemporaryTest.kt | 2 +- .../comm/DanaRsPacketNotifyAlarmTest.kt | 2 +- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 6 +-- .../DanaRsPacketNotifyMissedBolusAlarmTest.kt | 2 +- .../comm/DanaRsPacketOptionGetPumpTimeTest.kt | 2 +- .../DanaRsPacketOptionGetUserOptionTest.kt | 2 +- .../comm/DanaRsPacketOptionSetPumpTimeTest.kt | 2 +- .../comm/DanaRsPacketReviewBolusAvgTest.kt | 2 +- .../DanaRsPacketReviewGetPumpDecRatioTest.kt | 2 +- .../medtronic/driver/MedtronicPumpStatus.kt | 2 + .../info/nightscout/androidaps/TestBase.kt | 21 +++----- .../comm/MedtronicConverterUTest.java | 4 +- .../comm/MedtronicHistoryDataUTest.kt | 6 +-- .../pump/MedtronicPumpHistoryDecoderUTest.kt | 6 +-- .../data/MedtronicHistoryDataUTest.kt | 6 +-- .../medtronic/data/dto/BasalProfileUTest.java | 7 +-- .../omnipod/dash/history/DashHistoryTest.kt | 12 ++--- .../info/nightscout/androidaps/TestBase.kt | 20 ++++--- .../driver/comm/endecrypt/EnDecryptTest.kt | 2 +- .../driver/comm/message/MessagePacketTest.kt | 2 +- .../driver/comm/message/PayloadJoinerTest.kt | 2 +- .../comm/message/PayloadSplitJoinTest.kt | 2 +- .../comm/message/PayloadSplitterTest.kt | 2 +- .../message/StringLengthPrefixEncodingTest.kt | 2 +- .../dash/driver/comm/pair/KeyExchangeTest.kt | 2 +- .../driver/comm/session/EapMessageTest.kt | 2 +- .../dash/driver/comm/session/MilenageTest.kt | 2 +- .../pod/command/DeactivateCommandTest.kt | 2 +- .../pod/command/GetStatusCommandTest.kt | 2 +- .../pod/command/GetVersionCommandTest.kt | 2 +- .../pod/command/ProgramAlertsCommandTest.kt | 3 +- .../pod/command/ProgramBasalCommandTest.kt | 4 +- .../pod/command/ProgramBeepsCommandTest.kt | 2 +- .../pod/command/ProgramBolusCommandTest.kt | 2 +- .../command/ProgramTempBasalCommandTest.kt | 2 +- .../pod/command/SetUniqueIdCommandTest.kt | 4 +- .../pod/command/SilenceAlertsCommandTest.kt | 4 +- .../pod/command/StopDeliveryCommandTest.kt | 2 +- .../pod/command/SuspendDeliveryCommandTest.kt | 2 +- .../pod/response/AlarmStatusResponseTest.kt | 2 +- .../pod/response/DefaultStatusResponseTest.kt | 2 +- .../driver/pod/response/NakResponseTest.kt | 2 +- .../pod/response/SetUniqueIdResponseTest.kt | 2 +- .../pod/response/VersionResponseTest.kt | 2 +- .../pump/omnipod/dash/util/FunctionsTest.kt | 2 +- .../omnipod/eros/history/ErosHistoryTest.kt | 12 ++--- .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../omnipod/eros/OmnipodErosPumpPluginTest.kt | 6 +-- .../AapsOmnipodErosManagerTest.java | 2 +- .../command/AcknowledgeAlertsCommandTest.java | 6 +-- .../command/AssignAddressCommandTest.java | 4 +- .../BasalScheduleExtraCommandTest.java | 2 +- .../command/BeepConfigCommandTest.java | 2 +- .../command/BolusExtraCommandTest.java | 2 +- .../command/CancelDeliveryCommandTest.java | 2 +- .../command/ConfigureAlertsCommandTest.java | 2 +- .../command/DeactivatePodCommandTest.java | 6 +-- .../message/command/GetStatusCommandTest.java | 2 +- .../SetInsulinScheduleCommandTest.java | 2 +- .../message/command/SetupPodCommandTest.java | 2 +- .../command/TempBasalExtraCommandTest.java | 2 +- .../defs/schedule/BasalTableEntryTest.java | 2 +- .../message/response/ErrorResponseTest.java | 2 +- .../message/response/StatusResponseTest.java | 2 +- .../message/response/VersionResponseTest.java | 2 +- .../podinfo/PodInfoActiveAlertsTest.java | 2 +- .../response/podinfo/PodInfoDataLogTest.java | 2 +- .../podinfo/PodInfoDetailedStatusTest.java | 2 +- ...PodInfoFaultAndInitializationTimeTest.java | 2 +- .../podinfo/PodInfoRecentPulseLogTest.java | 2 +- .../response/podinfo/PodInfoResponseTest.java | 2 +- .../eros/driver/definition/AlertSetTest.java | 10 ++-- .../schedule/BasalScheduleTest.java | 12 ++--- .../eros/driver/util/TimeUtilTest.java | 12 ++--- .../manager/AapsErosPodStateManagerTest.kt | 6 +-- .../pump/common/sync/PumpSyncStorage.kt | 2 + .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../pump/common/hw/rileylink/ble/RFSpyTest.kt | 2 +- .../ble/RFToolsParametrizedUTest.java | 6 +-- .../common/hw/rileylink/ble/RFToolsUTest.java | 2 +- .../defs/RileyLinkFirmwareVersionTest.java | 4 +- .../info/nightscout/androidaps/TestBase.kt | 18 +++---- .../androidaps/TestBaseWithProfile.kt | 4 +- .../ui/defaultProfile/DefaultProfileTest.kt | 2 +- .../interaction/utils/Inevitable.kt | 6 +-- .../interaction/utils/Persistence.kt | 9 ++-- .../androidaps/interaction/utils/WearUtil.kt | 26 ++++----- .../info/nightscout/androidaps/TestBase.kt | 32 ++++++----- .../interaction/utils/DisplayFormatTest.kt | 7 +-- .../androidaps/interaction/utils/PairTest.kt | 2 +- .../interaction/utils/WearUtilTest.kt | 4 +- .../testing/mockers/WearUtilMocker.kt | 2 + 356 files changed, 849 insertions(+), 901 deletions(-) delete mode 100644 core/validators/src/androidTest/java/info/nightscout/core/validators/ExampleInstrumentedTest.kt delete mode 100644 core/validators/src/test/java/info/nightscout/core/validators/ExampleUnitTest.kt diff --git a/app-wear-shared/shared/src/test/java/info/nightscout/shared/SafeParseTest.kt b/app-wear-shared/shared/src/test/java/info/nightscout/shared/SafeParseTest.kt index c4300ef982..c2f8355ea6 100644 --- a/app-wear-shared/shared/src/test/java/info/nightscout/shared/SafeParseTest.kt +++ b/app-wear-shared/shared/src/test/java/info/nightscout/shared/SafeParseTest.kt @@ -1,7 +1,7 @@ package info.nightscout.shared import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test @Suppress("SpellCheckingInspection") class SafeParseTest { diff --git a/app/src/test/java/info/nightscout/androidaps/TestBase.kt b/app/src/test/java/info/nightscout/androidaps/TestBase.kt index ee5264cbde..4fd2aef548 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule -import java.util.* +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness +import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index cef4f2ddaf..194a53c0d4 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -18,7 +18,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers.anyDouble import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString @@ -49,7 +49,7 @@ open class TestBaseWithProfile : TestBase() { @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/app/src/test/java/info/nightscout/androidaps/data/QuickWizardTest.kt b/app/src/test/java/info/nightscout/androidaps/data/QuickWizardTest.kt index 2bb2dc9f2f..1ede0ab49b 100644 --- a/app/src/test/java/info/nightscout/androidaps/data/QuickWizardTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/data/QuickWizardTest.kt @@ -11,8 +11,8 @@ import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.shared.sharedPreferences.SP import org.json.JSONArray import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -47,7 +47,7 @@ class QuickWizardTest : TestBase() { private lateinit var quickWizard: QuickWizard - @Before + @BeforeEach fun mock() { `when`(sp.getString(R.string.key_quickwizard, "[]")).thenReturn("[]") diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index da5d29a6db..ed5fca4627 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -10,8 +10,8 @@ import info.nightscout.androidaps.implementations.ConfigImpl import info.nightscout.androidaps.insight.database.InsightDatabase import info.nightscout.androidaps.insight.database.InsightDatabaseDao import info.nightscout.androidaps.insight.database.InsightDbHelper -import info.nightscout.core.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin +import info.nightscout.core.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.constraints.ConstraintsImpl import info.nightscout.interfaces.constraints.Constraint @@ -45,8 +45,8 @@ import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -99,7 +99,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { } } - @Before + @BeforeEach fun prepare() { `when`(rh.gs(R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") `when`(rh.gs(R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt index 771e780350..c2df9e12e0 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt @@ -6,30 +6,30 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBase -import info.nightscout.interfaces.logging.UserEntryLogger -import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.database.impl.AppRepository import info.nightscout.interfaces.Config +import info.nightscout.interfaces.configBuilder.RunningConfiguration import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.iob.IobCobCalculator +import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.queue.CommandQueue +import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.plugins.aps.loop.LoopFragment import info.nightscout.plugins.aps.loop.LoopPlugin -import info.nightscout.interfaces.configBuilder.RunningConfiguration import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -58,7 +58,7 @@ class LoopPluginTest : TestBase() { private lateinit var loopPlugin: LoopPlugin val injector = HasAndroidInjector { AndroidInjector { } } - @Before fun prepareMock() { + @BeforeEach fun prepareMock() { loopPlugin = LoopPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, config, constraintChecker, rh, profileFunction, context, commandQueue, activePlugin, virtualPumpPlugin, iobCobCalculator, receiverStatusStore, fabricPrivacy, dateUtil, uel, diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt index 6814acceb0..2268075891 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPluginTest.kt @@ -3,15 +3,15 @@ package info.nightscout.androidaps.plugins.configBuilder import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase +import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.pump.PumpSync -import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock class ConfigBuilderPluginTest : TestBase() { @@ -31,7 +31,7 @@ class ConfigBuilderPluginTest : TestBase() { } - @Before + @BeforeEach fun prepareMock() { configBuilderPlugin = ConfigBuilderPlugin(injector, aapsLogger, rh, sp, RxBus(aapsSchedulers, aapsLogger), activePlugin, uel, pumpSync) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt index f064ebe410..5fd1f1f24b 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt @@ -11,8 +11,8 @@ import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` import java.io.File @@ -30,7 +30,7 @@ class MaintenancePluginTest : TestBase() { private lateinit var sut: MaintenancePlugin - @Before + @BeforeEach fun mock() { sut = MaintenancePlugin(injector, context, rh, sp, nsSettingsStatus, aapsLogger, config, fileListProvider, loggerUtils) `when`(loggerUtils.suffix).thenReturn(".log.zip") diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt index 6928744079..119e5d3226 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/safety/SafetyPluginTest.kt @@ -22,8 +22,8 @@ import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.plugins.source.GlimpPlugin import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -46,7 +46,7 @@ class SafetyPluginTest : TestBaseWithProfile() { private val injector = HasAndroidInjector { AndroidInjector { } } private val pumpDescription = PumpDescription() - @Before + @BeforeEach fun prepare() { `when`(rh.gs(R.string.hardlimit)).thenReturn("hard limit") `when`(rh.gs(R.string.itmustbepositivevalue)).thenReturn("it must be positive value") diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt index a06b0edfe1..f44cc5b90f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPluginTest.kt @@ -13,7 +13,7 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.json.JSONObject import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock class AbstractSensitivityPluginTest : TestBase() { diff --git a/app/src/test/java/info/nightscout/androidaps/pump/PumpEnactResultTest.kt b/app/src/test/java/info/nightscout/androidaps/pump/PumpEnactResultTest.kt index caa34d8832..9f41832129 100644 --- a/app/src/test/java/info/nightscout/androidaps/pump/PumpEnactResultTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/pump/PumpEnactResultTest.kt @@ -11,8 +11,8 @@ import info.nightscout.plugins.extensions.toText import info.nightscout.plugins.sync.nsShared.extensions.log import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` import org.skyscreamer.jsonassert.JSONAssert @@ -26,7 +26,7 @@ class PumpEnactResultTest : TestBaseWithProfile() { } } - @Before + @BeforeEach fun mock() { `when`(rh.gs(R.string.success)).thenReturn("Success") `when`(rh.gs(R.string.enacted)).thenReturn("Enacted") diff --git a/build.gradle b/build.gradle index 7edaf2cb76..66dd52b5aa 100644 --- a/build.gradle +++ b/build.gradle @@ -32,14 +32,15 @@ buildscript { swipe_version = '1.1.0' junit_version = '4.13.2' - mockito_version = '4.4.0' + junit_jupiter_version = '5.7.0' + mockito_version = '4.6.1' dexmaker_version = '1.2' retrofit2_version = '2.9.0' okhttp3_version = '4.10.0' byteBuddy_version = '1.12.8' - androidx_junit_version = '1.1.3' - androidx_rules_version = '1.4.0' + androidx_junit_version = '1.1.4' + androidx_rules_version = '1.5.0' rxandroidble_version = '1.12.1' replayshare_version = '2.2.0' diff --git a/core/core-main/src/main/java/info/nightscout/core/iob/iobCobCalculator/GlucoseStatusProvider.kt b/core/core-main/src/main/java/info/nightscout/core/iob/iobCobCalculator/GlucoseStatusProvider.kt index 01973df1f2..37ba784d5d 100644 --- a/core/core-main/src/main/java/info/nightscout/core/iob/iobCobCalculator/GlucoseStatusProvider.kt +++ b/core/core-main/src/main/java/info/nightscout/core/iob/iobCobCalculator/GlucoseStatusProvider.kt @@ -1,6 +1,7 @@ package info.nightscout.core.iob.iobCobCalculator import dagger.Reusable +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.core.iob.asRounded import info.nightscout.core.iob.log import info.nightscout.interfaces.iob.GlucoseStatus @@ -12,6 +13,7 @@ import javax.inject.Inject import kotlin.math.roundToLong @Reusable +@OpenForTesting class GlucoseStatusProvider @Inject constructor( private val aapsLogger: AAPSLogger, private val iobCobCalculator: IobCobCalculator, diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/TestBase.kt b/core/core-main/src/test/java/info/nightscout/androidaps/TestBase.kt index ff9c66abeb..263b5536c8 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -4,23 +4,21 @@ import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule -import java.util.* +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness +import java.util.Locale @Suppress("SpellCheckingInspection") +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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) diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 46752b695d..526edeab98 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -17,7 +17,7 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.Mock import org.mockito.Mockito.`when` @@ -57,7 +57,7 @@ open class TestBaseWithProfile : TestBase() { lateinit var invalidProfile: Profile @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { invalidProfileJSON = "{\"dia\":\"1\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt index 215ce818e1..d411bd1ab5 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt @@ -3,8 +3,8 @@ package info.nightscout.androidaps.data import info.nightscout.androidaps.TestBase import info.nightscout.interfaces.constraints.Constraint import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test /** * Created by mike on 19.03.2018. @@ -49,7 +49,7 @@ class ConstraintTest : TestBase() { Assert.assertEquals(10.0, d.originalValue(), 0.01) } - @Before + @BeforeEach fun prepareMock() { } } \ No newline at end of file diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt index ae226de539..027848cc0c 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt @@ -9,7 +9,7 @@ import info.nightscout.database.entities.TherapyEvent import info.nightscout.interfaces.pump.DetailedBolusInfo import org.apache.commons.lang3.builder.EqualsBuilder import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock class DetailedBolusInfoTest : TestBase() { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTest.kt index d36845c822..5bc7ca719c 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.data import info.nightscout.interfaces.iob.Iob import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class IobTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt index 497fe194c6..b825440046 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt @@ -11,8 +11,8 @@ import info.nightscout.core.iob.round import info.nightscout.interfaces.iob.IobTotal import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock @Suppress("SpellCheckingInspection") @@ -23,7 +23,7 @@ class IobTotalTest : TestBase() { private lateinit var dateUtil: DateUtil private var now = 0L - @Before + @BeforeEach fun prepare() { dateUtil = DateUtil(context) now = dateUtil.now() diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt index 49c3aeb2a1..be60ba2c01 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.data import info.nightscout.interfaces.iob.MealData import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MealDataTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt index 7e45b0d3dc..8a0f65cd5f 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt @@ -20,8 +20,8 @@ import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.anyInt import org.mockito.Mockito.anyString @@ -59,7 +59,7 @@ class ProfileTest : TestBase() { //String profileStore = "{\"defaultProfile\":\"Default\",\"store\":{\"Default\":" + validProfile + "}}"; - @Before + @BeforeEach fun prepare() { testPumpPlugin = TestPumpPlugin { AndroidInjector { } } dateUtil = DateUtil(context) @@ -159,7 +159,7 @@ class ProfileTest : TestBase() { 00:00 6.2 mmol/U 01:00 6.0 mmol/U 03:00 6.2 mmol/U - """.trimIndent(), p.getIsfList(rh, dateUtil) + """.trimIndent(), p.getIsfList(rh, dateUtil).replace(',', '.') ) // Test hour alignment diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt index a42958a9bd..8e18e7bae0 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt @@ -12,7 +12,7 @@ import info.nightscout.database.entities.data.checkSanity import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class BlockExtensionKtTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt index 1fa246105a..7528c226f4 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt @@ -4,7 +4,7 @@ import androidx.fragment.app.Fragment import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginType import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class PluginDescriptionTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt index d880e0905f..678117dec1 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.interfaces import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.interfaces.profile.PureProfile import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test internal class ProfileStoreTest : TestBaseWithProfile() { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt index e845e45d73..b28e7faee2 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/interfaces/PumpDescriptionTest.kt @@ -5,7 +5,7 @@ import info.nightscout.interfaces.pump.defs.PumpDescription import info.nightscout.interfaces.pump.defs.PumpTempBasalType import info.nightscout.interfaces.pump.defs.PumpType import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class PumpDescriptionTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt index 17c48abfa0..758c2260de 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt @@ -12,8 +12,8 @@ import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.utils.JsonHelper.safeGetDouble import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito.`when` @@ -329,7 +329,7 @@ class APSResultTest : TestBaseWithProfile() { Assert.assertEquals(false, apsResult.json()?.has("rate")) } - @Before + @BeforeEach fun prepare() { `when`(constraints.isClosedLoopAllowed(anyObject())).thenReturn(closedLoopEnabled) `when`(activePluginProvider.activePump).thenReturn(testPumpPlugin) diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt index c0f108c2dd..bf229f9cd2 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt @@ -1,8 +1,8 @@ package info.nightscout.androidaps.plugins.iob.iobCalculator import info.nightscout.androidaps.TestBase -import info.nightscout.core.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.core.iob.asRounded +import info.nightscout.core.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.core.iob.log import info.nightscout.database.entities.GlucoseValue import info.nightscout.interfaces.aps.AutosensDataStore @@ -11,8 +11,8 @@ import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -26,7 +26,7 @@ class GlucoseStatusTest : TestBase() { @Mock lateinit var iobCobCalculatorPlugin: IobCobCalculator @Mock lateinit var autosensDataStore: AutosensDataStore - @Before + @BeforeEach fun prepare() { `when`(iobCobCalculatorPlugin.ads).thenReturn(autosensDataStore) } @@ -103,7 +103,7 @@ class GlucoseStatusTest : TestBase() { Assert.assertEquals(1514766900000L, glucoseStatus.date) // latest date } - @Before + @BeforeEach fun initMocking() { `when`(dateUtil.now()).thenReturn(1514766900000L + T.mins(1).msecs()) `when`(iobCobCalculatorPlugin.ads).thenReturn(autosensDataStore) diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt index a82210137b..907e21d8bb 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt @@ -7,8 +7,8 @@ import info.nightscout.database.entities.GlucoseValue import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock class AutosensDataStoreTest : TestBase() { @@ -19,7 +19,7 @@ class AutosensDataStoreTest : TestBase() { private val autosensDataStore = AutosensDataStoreObject() - @Before + @BeforeEach fun mock() { dateUtil = DateUtil(context) } diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/pump/common/utils/DateTimeUtilUTest.java b/core/core-main/src/test/java/info/nightscout/androidaps/pump/common/utils/DateTimeUtilUTest.java index 2de161c2cb..03f24af889 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/pump/common/utils/DateTimeUtilUTest.java +++ b/core/core-main/src/test/java/info/nightscout/androidaps/pump/common/utils/DateTimeUtilUTest.java @@ -1,7 +1,7 @@ package info.nightscout.androidaps.pump.common.utils; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.core.utils.DateTimeUtil; diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt index 8c1ae814e4..5928b094f5 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt @@ -6,7 +6,7 @@ import org.hamcrest.CoreMatchers.containsString import org.hamcrest.CoreMatchers.not import org.junit.Assert import org.junit.Assume.assumeThat -import org.junit.Test +import org.junit.jupiter.api.Test // https://stackoverflow.com/questions/52344522/joseexception-couldnt-create-aes-gcm-nopadding-cipher-illegal-key-size // https://stackoverflow.com/questions/47708951/can-aes-256-work-on-android-devices-with-api-level-26 diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt index 584236da62..dd27b64571 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt @@ -7,10 +7,10 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` -import java.util.* +import java.util.Date class DateUtilTest : TestBase() { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt index bb8a26c422..aa8d84a050 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.utils import info.nightscout.interfaces.utils.DecimalFormatter import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DecimalFormatterTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt index bdc4c3a355..a711f577c1 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.utils import info.nightscout.interfaces.utils.JsonHelper import org.json.JSONObject import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test @Suppress("SpellCheckingInspection") class JsonHelperTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.kt index d87289fb61..3007f94987 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.kt @@ -2,8 +2,8 @@ package info.nightscout.androidaps.utils import info.nightscout.interfaces.utils.MidnightTime import org.junit.Assert -import org.junit.Test -import java.util.* +import org.junit.jupiter.api.Test +import java.util.Calendar class MidnightTimeTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/RoundTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/RoundTest.kt index 1d7865c4cb..19c039ec81 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/RoundTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/RoundTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.utils import info.nightscout.interfaces.utils.Round import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class RoundTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/StringUtilsTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/StringUtilsTest.kt index 272dcfb061..3b247d27b1 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/StringUtilsTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/StringUtilsTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.utils import info.nightscout.core.utils.receivers.StringUtils import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class StringUtilsTest { diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/TTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/TTest.kt index 02da4b6b45..e4d8375c40 100644 --- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/TTest.kt +++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/TTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.utils import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import kotlin.math.abs @Suppress("SpellCheckingInspection") diff --git a/core/core-main/src/test/java/info/nightscout/core/wizard/BolusWizardTest.kt b/core/core-main/src/test/java/info/nightscout/core/wizard/BolusWizardTest.kt index 6a0fe61522..37f0f3e5eb 100644 --- a/core/core-main/src/test/java/info/nightscout/core/wizard/BolusWizardTest.kt +++ b/core/core-main/src/test/java/info/nightscout/core/wizard/BolusWizardTest.kt @@ -22,7 +22,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito import org.mockito.Mockito.`when` diff --git a/core/core-main/test_dependencies.gradle b/core/core-main/test_dependencies.gradle index bc9915e4bb..b2cd685f5b 100644 --- a/core/core-main/test_dependencies.gradle +++ b/core/core-main/test_dependencies.gradle @@ -1,14 +1,17 @@ dependencies { - testImplementation "junit:junit:$junit_version" + //testImplementation "junit:junit:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter:$junit_jupiter_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" testImplementation "org.json:json:$json_version" - testImplementation "org.mockito:mockito-core:$mockito_version" - testImplementation "org.mockito:mockito-inline:$mockito_version" + testImplementation "org.mockito:mockito-junit-jupiter:$mockito_version" + testImplementation "org.mockito.kotlin:mockito-kotlin:4.1.0" + //testImplementation "org.mockito:mockito-inline:$mockito_version" testImplementation "joda-time:joda-time:$jodatime_version" testImplementation "com.google.truth:truth:1.1.3" testImplementation "org.skyscreamer:jsonassert:1.5.0" testImplementation "org.hamcrest:hamcrest-all:1.3" - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' androidTestImplementation "androidx.test.ext:junit-ktx:$androidx_junit_version" androidTestImplementation "androidx.test:rules:$androidx_rules_version" @@ -20,6 +23,7 @@ tasks.matching { it instanceof Test }.all { // use to display stdout in travis testLogging.events = ["failed", "skipped", "started", "standard_out"] testLogging.exceptionFormat = "full" + useJUnitPlatform() } android { diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/plugin/PluginBase.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/plugin/PluginBase.kt index bc61cb95a4..873bfc628b 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/plugin/PluginBase.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/plugin/PluginBase.kt @@ -71,7 +71,7 @@ abstract class PluginBase( * So far plugin can have it's main type + ConstraintInterface * ConstraintInterface is enabled if main plugin is enabled */ - fun setPluginEnabled(type: PluginType, newState: Boolean) { + open fun setPluginEnabled(type: PluginType, newState: Boolean) { if (type == pluginDescription.mainType) { if (newState) { // enabling plugin if (state != State.ENABLED) { @@ -91,7 +91,7 @@ abstract class PluginBase( } } - fun setFragmentVisible(type: PluginType, fragmentVisible: Boolean) { + open fun setFragmentVisible(type: PluginType, fragmentVisible: Boolean) { if (type == pluginDescription.mainType) { this.fragmentVisible = fragmentVisible && specialEnableCondition() } diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/utils/TimerUtil.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/utils/TimerUtil.kt index 741e4ba519..9537964de0 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/utils/TimerUtil.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/utils/TimerUtil.kt @@ -3,11 +3,13 @@ package info.nightscout.interfaces.utils import android.content.Context import android.content.Intent import android.provider.AlarmClock +import info.nightscout.androidaps.annotations.OpenForTesting import javax.inject.Inject import javax.inject.Singleton +@OpenForTesting @Singleton -class TimerUtil @Inject constructor( +open class TimerUtil @Inject constructor( private val context: Context ) { diff --git a/core/validators/src/androidTest/java/info/nightscout/core/validators/ExampleInstrumentedTest.kt b/core/validators/src/androidTest/java/info/nightscout/core/validators/ExampleInstrumentedTest.kt deleted file mode 100644 index 27fceb03e0..0000000000 --- a/core/validators/src/androidTest/java/info/nightscout/core/validators/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -package info.nightscout.core.validators - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("info.nightscout.core.validators.test", appContext.packageName) - } -} \ No newline at end of file diff --git a/core/validators/src/test/java/info/nightscout/core/validators/ExampleUnitTest.kt b/core/validators/src/test/java/info/nightscout/core/validators/ExampleUnitTest.kt deleted file mode 100644 index e66e4b3d94..0000000000 --- a/core/validators/src/test/java/info/nightscout/core/validators/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package info.nightscout.core.validators - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * 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) - } -} \ No newline at end of file diff --git a/implementation/src/test/java/info/nightscout/androidaps/TestBase.kt b/implementation/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..4fd2aef548 100644 --- a/implementation/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/implementation/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index cef4f2ddaf..194a53c0d4 100644 --- a/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -18,7 +18,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers.anyDouble import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString @@ -49,7 +49,7 @@ open class TestBaseWithProfile : TestBase() { @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index af18cd7321..b3cdd8a6f8 100644 --- a/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/implementation/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.Pump @@ -13,6 +14,7 @@ import info.nightscout.interfaces.utils.TimeChangeType import org.json.JSONObject @Suppress("MemberVisibilityCanBePrivate") +@OpenForTesting class TestPumpPlugin(val injector: HasAndroidInjector) : Pump { var connected = false diff --git a/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt b/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt index cf91ad1abe..8a97bad30a 100644 --- a/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/BolusTimerImplTest.kt @@ -19,8 +19,8 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.anyInt import org.mockito.Mockito.`when` @@ -52,7 +52,7 @@ class BolusTimerImplTest : TestBase() { private lateinit var automationPlugin: AutomationPlugin private lateinit var sut: BolusTimerImpl - @Before + @BeforeEach fun init() { `when`(rh.gs(anyInt())).thenReturn("") `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) diff --git a/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt b/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt index 1e4433ccdf..87d82e2961 100644 --- a/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/CarbTimerImplTest.kt @@ -20,10 +20,11 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito +import org.mockito.Mockito.any import org.mockito.Mockito.anyInt import org.mockito.Mockito.`when` @@ -40,7 +41,6 @@ class CarbTimerImplTest : TestBase() { @Mock lateinit var locationServiceHelper: LocationServiceHelper @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var profileFunction: ProfileFunction - @Mock lateinit var timerUtil: TimerUtil private val injector = HasAndroidInjector { AndroidInjector { @@ -51,15 +51,17 @@ class CarbTimerImplTest : TestBase() { } } private lateinit var dateUtil: DateUtil + private lateinit var timerUtil: TimerUtil private lateinit var automationPlugin: AutomationPlugin private lateinit var sut: CarbTimerImpl - @Before + @BeforeEach fun init() { `when`(rh.gs(anyInt())).thenReturn("") `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) dateUtil = DateUtil(context) + timerUtil = TimerUtil(context) automationPlugin = AutomationPlugin(injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil, activePlugin) sut = CarbTimerImpl(injector, rh, automationPlugin, timerUtil) } @@ -73,6 +75,6 @@ class CarbTimerImplTest : TestBase() { Assert.assertEquals(0, automationPlugin.size()) sut.scheduleTimeToEatReminder(1) - Mockito.verify(timerUtil, Mockito.times(1)).scheduleReminder(1, "") + Mockito.verify(context, Mockito.times(1)).startActivity(any()) } } \ No newline at end of file diff --git a/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt b/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt index 18b8c8b985..3831f62381 100644 --- a/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/pump/DetailedBolusInfoStorageTest.kt @@ -4,8 +4,8 @@ import info.nightscout.androidaps.TestBase import info.nightscout.interfaces.pump.DetailedBolusInfo import org.junit.Assert.assertEquals import org.junit.Assert.assertNull -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test class DetailedBolusInfoStorageTest : TestBase() { @@ -24,7 +24,7 @@ class DetailedBolusInfoStorageTest : TestBase() { info3.insulin = 5.0 } - @Before + @BeforeEach fun prepare() { detailedBolusInfoStorage = DetailedBolusInfoStorageImpl(aapsLogger) } diff --git a/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt b/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt index eaf5c2c35e..1709fba4fb 100644 --- a/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/pump/TemporaryBasalStorageTest.kt @@ -1,12 +1,11 @@ package info.nightscout.implementation.pump import info.nightscout.androidaps.TestBase -import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.pump.PumpSync import org.junit.Assert.assertEquals import org.junit.Assert.assertNull -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test class TemporaryBasalStorageTest : TestBase() { @@ -16,7 +15,7 @@ class TemporaryBasalStorageTest : TestBase() { private lateinit var temporaryBasalStorage: TemporaryBasalStorageImpl - @Before + @BeforeEach fun prepare() { temporaryBasalStorage = TemporaryBasalStorageImpl(aapsLogger) } diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt index 127ee5ca58..e3cac91b4b 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt @@ -39,8 +39,8 @@ import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import io.reactivex.rxjava3.core.Single import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.anyLong import org.mockito.Mockito.mock @@ -118,7 +118,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { private lateinit var commandQueue: CommandQueueImplementation private lateinit var testPumpPlugin: TestPumpPlugin - @Before + @BeforeEach fun prepare() { commandQueue = CommandQueueMocked( injector, aapsLogger, rxBus, aapsSchedulers, rh, diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt index e393dfdfa1..ae82b04f92 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt @@ -20,8 +20,8 @@ import info.nightscout.interfaces.queue.Command import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito @@ -54,7 +54,7 @@ class QueueThreadTest : TestBaseWithProfile() { private lateinit var commandQueue: CommandQueueImplementation private lateinit var sut: QueueThread - @Before + @BeforeEach fun prepare() { pumpPlugin = TestPumpPlugin(injector) commandQueue = CommandQueueImplementation( diff --git a/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFS.kt b/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFS.kt index 14449e6515..c09ca7b859 100644 --- a/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFS.kt +++ b/plugins/aps/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFS.kt @@ -1,5 +1,6 @@ package info.nightscout.plugins.general.autotune +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.interfaces.logging.LoggerUtils import info.nightscout.plugins.aps.R import info.nightscout.plugins.general.autotune.data.ATProfile @@ -23,6 +24,7 @@ import javax.inject.Inject import javax.inject.Singleton @Singleton +@OpenForTesting class AutotuneFS @Inject constructor( private val rh: ResourceHelper, private val loggerUtils: LoggerUtils diff --git a/plugins/aps/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/aps/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..4fd2aef548 100644 --- a/plugins/aps/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/plugins/aps/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/plugins/aps/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/plugins/aps/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index d94df05543..ef46cbe7e0 100644 --- a/plugins/aps/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/plugins/aps/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -17,7 +17,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers.anyDouble import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString @@ -48,7 +48,7 @@ open class TestBaseWithProfile : TestBase() { @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt b/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt index 2b9655bcc6..7190bd1001 100644 --- a/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt +++ b/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt @@ -16,8 +16,8 @@ import info.nightscout.shared.utils.T import org.json.JSONArray import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` import java.io.File @@ -33,7 +33,7 @@ class AutotuneCoreTest : TestBaseWithProfile() { private var autotuneMin = 0.0 private var autotuneMax = 0.0 - @Before + @BeforeEach fun initData() { autotuneCore = AutotuneCore(sp, autotuneFS) TimeZone.setDefault(TimeZone.getTimeZone("GMT+2")) diff --git a/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt b/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt index d643741094..e4d5905647 100644 --- a/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt +++ b/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt @@ -24,8 +24,8 @@ import info.nightscout.shared.utils.T import org.json.JSONArray import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` import java.io.File @@ -45,7 +45,7 @@ class AutotunePrepTest : TestBaseWithProfile() { private var autotuneMax = 0.0 private var startDayTime = 0L - @Before + @BeforeEach fun initData() { ts = T.msecs(TimeZone.getDefault().getOffset(System.currentTimeMillis()).toLong()).hours().toInt() - 2 } diff --git a/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/PreppedGlucoseTest.kt b/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/PreppedGlucoseTest.kt index a88405755f..222679afd7 100644 --- a/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/PreppedGlucoseTest.kt +++ b/plugins/aps/src/test/java/info/nightscout/plugins/general/autotune/PreppedGlucoseTest.kt @@ -1,11 +1,13 @@ package info.nightscout.plugins.general.autotune import info.nightscout.androidaps.TestBaseWithProfile +import info.nightscout.plugins.general.autotune.data.BGDatum +import info.nightscout.plugins.general.autotune.data.CRDatum import info.nightscout.plugins.general.autotune.data.PreppedGlucose import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import java.io.File class PreppedGlucoseTest : TestBaseWithProfile() { @@ -13,7 +15,7 @@ class PreppedGlucoseTest : TestBaseWithProfile() { private lateinit var prep1: PreppedGlucose private lateinit var prepJson1: String - @Before + @BeforeEach fun initData() { prepJson1 = File("src/test/res/autotune/test1/autotune.2022-05-21.json").readText() prep1 = PreppedGlucose(JSONObject(prepJson1), dateUtil) @@ -22,22 +24,22 @@ class PreppedGlucoseTest : TestBaseWithProfile() { @Test fun preppedGlucoseLoadTest() { // Test if load from file of OpenAPS categorisation is Ok val crData0 = - info.nightscout.plugins.general.autotune.data.CRDatum( + CRDatum( JSONObject("{\"CRInitialIOB\":13.594,\"CRInitialBG\":123,\"CRInitialCarbTime\":\"2022-05-21T07:54:09.000Z\",\"CREndIOB\":-0.155,\"CREndBG\":98,\"CREndTime\":\"2022-05-21T11:19:08.000Z\",\"CRCarbs\":70,\"CRInsulin\":-2.13}"), dateUtil ) val csfDataEnd = - info.nightscout.plugins.general.autotune.data.BGDatum( + BGDatum( JSONObject("{\"device\":\"AndroidAPS-DexcomG6\",\"date\":1653176050000,\"dateString\":\"2022-05-21T23:34:10.000Z\",\"isValid\":true,\"sgv\":127,\"direction\":\"Flat\",\"type\":\"sgv\",\"_id\":\"6289771371a363000480abc1\",\"glucose\":127,\"avgDelta\":\"2.50\",\"BGI\":-2.93,\"deviation\":\"5.43\",\"mealCarbs\":0,\"mealAbsorption\":\"end\"}"), dateUtil ) val isfData0 = - info.nightscout.plugins.general.autotune.data.BGDatum( + BGDatum( JSONObject("{\"device\":\"AndroidAPS-DexcomG6\",\"date\":1653108249000,\"dateString\":\"2022-05-21T04:44:09.000Z\",\"isValid\":true,\"sgv\":123,\"direction\":\"FortyFiveDown\",\"type\":\"sgv\",\"_id\":\"62886e2919e2e60004989bba\",\"glucose\":123,\"avgDelta\":\"-7.50\",\"BGI\":-7.59,\"deviation\":\"0.09\"}"), dateUtil ) val basalDataEnd = - info.nightscout.plugins.general.autotune.data.BGDatum( + BGDatum( JSONObject("{\"device\":\"AndroidAPS-DexcomG6\",\"date\":1653180549000,\"dateString\":\"2022-05-22T00:49:09.000Z\",\"isValid\":true,\"sgv\":121,\"direction\":\"FortyFiveDown\",\"type\":\"sgv\",\"_id\":\"628988a3da46aa0004d1e0f5\",\"glucose\":121,\"avgDelta\":\"-5.25\",\"BGI\":-3.32,\"deviation\":\"-1.93\"}"), dateUtil ) diff --git a/plugins/automation/src/main/java/info/nightscout/automation/services/LocationServiceHelper.kt b/plugins/automation/src/main/java/info/nightscout/automation/services/LocationServiceHelper.kt index feb1f58a0d..9cf6e64b01 100644 --- a/plugins/automation/src/main/java/info/nightscout/automation/services/LocationServiceHelper.kt +++ b/plugins/automation/src/main/java/info/nightscout/automation/services/LocationServiceHelper.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.Intent import android.content.ServiceConnection import android.os.IBinder +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.interfaces.NotificationHolder import javax.inject.Inject import javax.inject.Singleton @@ -19,6 +20,7 @@ import javax.inject.Singleton */ @Singleton +@OpenForTesting class LocationServiceHelper @Inject constructor( private val notificationHolder: NotificationHolder ) { diff --git a/plugins/automation/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/automation/src/test/java/info/nightscout/androidaps/TestBase.kt index b55d0aae33..bbef4c099b 100644 --- a/plugins/automation/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/plugins/automation/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,26 +3,24 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.ArgumentMatcher import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale @Suppress("SpellCheckingInspection") +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/plugins/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/plugins/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 04796937b5..2fc32c0b54 100644 --- a/plugins/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/plugins/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -16,7 +16,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.Mock @Suppress("SpellCheckingInspection") @@ -42,7 +42,7 @@ open class TestBaseWithProfile : TestBase() { lateinit var validProfile: Profile @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/plugins/automation/src/test/java/info/nightscout/automation/AutomationEventTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/AutomationEventTest.kt index cb3503b554..77e4ac9285 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/AutomationEventTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/AutomationEventTest.kt @@ -15,7 +15,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import org.json.JSONObject import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock class AutomationEventTest : TestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/ComposeTriggerTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/ComposeTriggerTest.kt index 7b30c7a594..e11d054ccd 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/ComposeTriggerTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/ComposeTriggerTest.kt @@ -7,7 +7,7 @@ import info.nightscout.automation.triggers.Trigger import info.nightscout.automation.triggers.TriggerConnector import info.nightscout.automation.triggers.TriggerDummy import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ComposeTriggerTest : TestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionAlarmTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionAlarmTest.kt index 4cadbb79da..51f9381729 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionAlarmTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionAlarmTest.kt @@ -14,8 +14,8 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito.`when` @@ -25,10 +25,10 @@ class ActionAlarmTest : TestBase() { @Mock lateinit var rh: ResourceHelper @Mock lateinit var rxBus: RxBus @Mock lateinit var context: Context - @Mock lateinit var timerUtil: TimerUtil @Mock lateinit var dateUtil: DateUtil @Mock lateinit var config: Config + private lateinit var timerUtil: TimerUtil private lateinit var sut: ActionAlarm var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { @@ -46,12 +46,12 @@ class ActionAlarmTest : TestBase() { } } - @Before + @BeforeEach fun setup() { `when`(context.getString(info.nightscout.core.main.R.string.ok)).thenReturn("OK") `when`(context.getString(info.nightscout.core.main.R.string.alarm)).thenReturn("Alarm") `when`(rh.gs(ArgumentMatchers.eq(R.string.alarm_message), ArgumentMatchers.anyString())).thenReturn("Alarm: %s") - + timerUtil = TimerUtil(context) sut = ActionAlarm(injector) } @@ -69,6 +69,7 @@ class ActionAlarmTest : TestBase() { } @Test fun doActionTest() { + sut.text = InputString("Asd") sut.doAction(object : Callback() { override fun run() { Assert.assertTrue(result.success) diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt index 4491760ba6..2941442f69 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt @@ -1,16 +1,16 @@ package info.nightscout.automation.actions +import info.nightscout.automation.elements.InputCarePortalMenu +import info.nightscout.automation.elements.InputDuration +import info.nightscout.automation.elements.InputString import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction import info.nightscout.database.impl.transactions.Transaction import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.queue.Callback -import info.nightscout.automation.elements.InputCarePortalMenu -import info.nightscout.automation.elements.InputDuration -import info.nightscout.automation.elements.InputString import io.reactivex.rxjava3.core.Single import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mockito.`when` @@ -18,7 +18,7 @@ class ActionCarePortalEventTest : ActionsTestBase() { private lateinit var sut: ActionCarePortalEvent - @Before + @BeforeEach fun setup() { `when`(sp.getString(ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn("AAPS") `when`( diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionDummyTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionDummyTest.kt index 7dc016bee4..a50581178f 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionDummyTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionDummyTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.actions import org.json.JSONObject import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ActionDummyTest : ActionsTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopDisableTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopDisableTest.kt index abe270509e..808c826696 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopDisableTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopDisableTest.kt @@ -4,8 +4,8 @@ import info.nightscout.automation.R import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.queue.Callback import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito import org.mockito.Mockito.`when` @@ -14,7 +14,7 @@ class ActionLoopDisableTest : ActionsTestBase() { lateinit var sut: ActionLoopDisable - @Before + @BeforeEach fun setup() { testPumpPlugin.pumpDescription.isTempBasalCapable = true diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopEnableTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopEnableTest.kt index ac79bec92f..822f788029 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopEnableTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopEnableTest.kt @@ -4,8 +4,8 @@ import info.nightscout.automation.R import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.queue.Callback import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito import org.mockito.Mockito.`when` @@ -13,7 +13,7 @@ class ActionLoopEnableTest : ActionsTestBase() { lateinit var sut: ActionLoopEnable - @Before + @BeforeEach fun setup() { testPumpPlugin.pumpDescription.isTempBasalCapable = true diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt index e6e0ea5cdd..52a2895da1 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt @@ -7,15 +7,15 @@ import info.nightscout.database.impl.transactions.Transaction import info.nightscout.interfaces.queue.Callback import io.reactivex.rxjava3.core.Single import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class ActionLoopResumeTest : ActionsTestBase() { lateinit var sut: ActionLoopResume - @Before + @BeforeEach fun setup() { `when`(rh.gs(info.nightscout.core.main.R.string.resumeloop)).thenReturn("Resume loop") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopSuspendTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopSuspendTest.kt index ee2007379c..4aad7d0d94 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopSuspendTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionLoopSuspendTest.kt @@ -4,8 +4,8 @@ import info.nightscout.automation.R import info.nightscout.automation.elements.InputDuration import info.nightscout.interfaces.queue.Callback import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mockito import org.mockito.Mockito.`when` @@ -14,7 +14,7 @@ class ActionLoopSuspendTest : ActionsTestBase() { lateinit var sut: ActionLoopSuspend - @Before + @BeforeEach fun setup() { `when`(context.getString(info.nightscout.core.main.R.string.suspendloop)).thenReturn("Suspend loop") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt index d456dbc4f4..bd29ba0d30 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt @@ -15,8 +15,8 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import io.reactivex.rxjava3.core.Completable import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito @@ -43,7 +43,7 @@ class ActionNotificationTest : TestBase() { } } - @Before + @BeforeEach fun setup() { `when`(context.getString(info.nightscout.core.main.R.string.ok)).thenReturn("OK") `when`(rh.gs(info.nightscout.core.main.R.string.notification)).thenReturn("Notification") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchPercentTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchPercentTest.kt index f65294c664..ab47ea0102 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchPercentTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchPercentTest.kt @@ -1,12 +1,12 @@ package info.nightscout.automation.actions -import info.nightscout.interfaces.queue.Callback import info.nightscout.automation.R import info.nightscout.automation.elements.InputDuration import info.nightscout.automation.elements.InputPercent +import info.nightscout.interfaces.queue.Callback import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito import org.mockito.Mockito.`when` @@ -14,7 +14,7 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() { private lateinit var sut: ActionProfileSwitchPercent - @Before + @BeforeEach fun setup() { `when`(rh.gs(R.string.startprofileforever)).thenReturn("Start profile %d%%") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchTest.kt index e5393dacb7..a65ccb5930 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionProfileSwitchTest.kt @@ -4,8 +4,8 @@ import info.nightscout.automation.R import info.nightscout.automation.elements.InputProfileName import info.nightscout.interfaces.queue.Callback import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers.anyLong import org.mockito.Mockito @@ -19,7 +19,7 @@ class ActionProfileSwitchTest : ActionsTestBase() { private val stringJson = "{\"data\":{\"profileToSwitchTo\":\"Test\"},\"type\":\"ActionProfileSwitch\"}" - @Before fun setUp() { + @BeforeEach fun setUp() { `when`(rh.gs(R.string.profilename)).thenReturn("Change profile to") `when`(rh.gs(ArgumentMatchers.eq(R.string.changengetoprofilename), ArgumentMatchers.anyString())).thenReturn("Change profile to %s") `when`(context.getString(R.string.alreadyset)).thenReturn("Already set") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionSendSMSTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionSendSMSTest.kt index 395ebd588f..0e8fe870fb 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionSendSMSTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionSendSMSTest.kt @@ -1,11 +1,11 @@ package info.nightscout.automation.actions -import info.nightscout.interfaces.queue.Callback import info.nightscout.automation.R import info.nightscout.automation.elements.InputString +import info.nightscout.interfaces.queue.Callback import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.anyString import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito.`when` @@ -14,7 +14,7 @@ class ActionSendSMSTest : ActionsTestBase() { private lateinit var sut: ActionSendSMS - @Before + @BeforeEach fun setup() { `when`(rh.gs(eq(R.string.sendsmsactionlabel), anyString())).thenReturn("Send SMS: %s") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt index dc5f7f78cd..e19eb4d11a 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt @@ -1,17 +1,17 @@ package info.nightscout.automation.actions -import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction -import info.nightscout.database.impl.transactions.Transaction import info.nightscout.automation.R import info.nightscout.automation.elements.InputDuration import info.nightscout.automation.elements.InputTempTarget import info.nightscout.database.entities.TemporaryTarget +import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction +import info.nightscout.database.impl.transactions.Transaction import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.queue.Callback import io.reactivex.rxjava3.core.Single import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito import org.mockito.Mockito.`when` @@ -19,7 +19,7 @@ class ActionStartTempTargetTest : ActionsTestBase() { private lateinit var sut: ActionStartTempTarget - @Before + @BeforeEach fun setup() { `when`(rh.gs(R.string.starttemptarget)).thenReturn("Start temp target") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopProcessingTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopProcessingTest.kt index 450d978cf7..c79af3c209 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopProcessingTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopProcessingTest.kt @@ -1,17 +1,17 @@ package info.nightscout.automation.actions -import info.nightscout.interfaces.queue.Callback import info.nightscout.automation.R +import info.nightscout.interfaces.queue.Callback import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class ActionStopProcessingTest : ActionsTestBase() { lateinit var sut: ActionStopProcessing - @Before + @BeforeEach fun setup() { `when`(rh.gs(R.string.stop_processing)).thenReturn("Stop processing") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt index f56ea7ae3f..70c58e38f3 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt @@ -1,14 +1,14 @@ package info.nightscout.automation.actions -import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction -import info.nightscout.database.impl.transactions.Transaction import info.nightscout.automation.R import info.nightscout.database.entities.TemporaryTarget +import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction +import info.nightscout.database.impl.transactions.Transaction import info.nightscout.interfaces.queue.Callback import io.reactivex.rxjava3.core.Single import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito import org.mockito.Mockito.`when` @@ -16,7 +16,7 @@ class ActionStopTempTargetTest : ActionsTestBase() { private lateinit var sut: ActionStopTempTarget - @Before + @BeforeEach fun setup() { `when`(rh.gs(R.string.stoptemptarget)).thenReturn("Stop temp target") diff --git a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt index 44fc8a3fd6..993295faab 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt @@ -5,7 +5,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestPumpPlugin -import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.automation.triggers.Trigger import info.nightscout.database.entities.DeviceStatus import info.nightscout.database.entities.OfflineEvent @@ -15,9 +14,11 @@ import info.nightscout.interfaces.aps.Loop import info.nightscout.interfaces.configBuilder.RunningConfiguration import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.iob.IobCobCalculator +import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription +import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileSource @@ -30,7 +31,7 @@ import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.Mock import org.mockito.Mockito.`when` @@ -74,6 +75,7 @@ ActionsTestBase : TestBaseWithProfile() { runningConfiguration: RunningConfiguration, version: String ): DeviceStatus? = null + override fun setPluginEnabled(type: PluginType, newState: Boolean) {} } @Mock lateinit var sp: SP @@ -191,7 +193,7 @@ ActionsTestBase : TestBaseWithProfile() { } } - @Before + @BeforeEach fun mock() { testPumpPlugin = TestPumpPlugin(pluginDescription, aapsLogger, rh, injector) `when`(activePlugin.activePump).thenReturn(testPumpPlugin) diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorConnectTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorConnectTest.kt index cca7b80c41..db75ad2a24 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorConnectTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorConnectTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ComparatorConnectTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorExistsTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorExistsTest.kt index d0aab2680b..e6257b169d 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorExistsTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorExistsTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ComparatorExistsTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorTest.kt index b49396950a..d1ef1456c0 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/ComparatorTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ComparatorTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputBgTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputBgTest.kt index 785a0d9d60..7c16a78dd7 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputBgTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputBgTest.kt @@ -1,10 +1,10 @@ package info.nightscout.automation.elements -import info.nightscout.interfaces.GlucoseUnit import info.nightscout.automation.triggers.TriggerTestBase +import info.nightscout.interfaces.GlucoseUnit import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class InputBgTest : TriggerTestBase() { @@ -20,7 +20,7 @@ class InputBgTest : TriggerTestBase() { Assert.assertEquals(GlucoseUnit.MGDL, i.units) } - @Before + @BeforeEach fun prepare() { `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputCarePortalEventTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputCarePortalEventTest.kt index 64ea7220a9..87f58d3bcf 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputCarePortalEventTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputCarePortalEventTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class InputCarePortalEventTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputDurationTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputDurationTest.kt index cf02692df8..04838c0a03 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputDurationTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputDurationTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class InputDurationTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputInsulinTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputInsulinTest.kt index 00a0fea092..7a50ca33ee 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputInsulinTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputInsulinTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class InputInsulinTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputPercentTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputPercentTest.kt index e53295b8fc..4731d3c82a 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputPercentTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputPercentTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class InputPercentTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputProfileNameTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputProfileNameTest.kt index 02b0d088a9..6aa76dbba9 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputProfileNameTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputProfileNameTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class InputProfileNameTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputStringTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputStringTest.kt index 03d5c45934..d9e19463e6 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputStringTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputStringTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class InputStringTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputTempTargetTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputTempTargetTest.kt index 76c0b544da..833d506e31 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/InputTempTargetTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/InputTempTargetTest.kt @@ -1,9 +1,9 @@ package info.nightscout.automation.elements -import info.nightscout.interfaces.GlucoseUnit import info.nightscout.automation.triggers.TriggerTestBase +import info.nightscout.interfaces.GlucoseUnit import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class InputTempTargetTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/LabelWithElementTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/LabelWithElementTest.kt index d1b390de69..f0e572c572 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/LabelWithElementTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/LabelWithElementTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class LabelWithElementTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/LayoutBuilderTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/LayoutBuilderTest.kt index 35130ebc34..f06a46e773 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/LayoutBuilderTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/LayoutBuilderTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class LayoutBuilderTest : TestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/elements/StaticLabelTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/elements/StaticLabelTest.kt index a67f8470c6..1c05c01186 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/elements/StaticLabelTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/elements/StaticLabelTest.kt @@ -3,7 +3,7 @@ package info.nightscout.automation.elements import info.nightscout.automation.triggers.TriggerDummy import info.nightscout.automation.triggers.TriggerTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class StaticLabelTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerAutosensValueTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerAutosensValueTest.kt index 5b3a310b80..dd88746f56 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerAutosensValueTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerAutosensValueTest.kt @@ -1,13 +1,13 @@ package info.nightscout.automation.triggers import com.google.common.base.Optional -import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject import info.nightscout.automation.R import info.nightscout.automation.elements.Comparator +import info.nightscout.core.iob.iobCobCalculator.data.AutosensDataObject import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mockito import org.mockito.Mockito.`when` @@ -105,7 +105,7 @@ class TriggerAutosensValueTest : TriggerTestBase() { Assert.assertEquals(Optional.of(R.drawable.ic_as), TriggerAutosensValue(injector).icon()) } - @Before + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBTDeviceTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBTDeviceTest.kt index c37dcb33ec..c9df78a2ab 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBTDeviceTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBTDeviceTest.kt @@ -4,7 +4,7 @@ import com.google.common.base.Optional import info.nightscout.automation.elements.ComparatorConnect import org.json.JSONObject import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test @Suppress("SpellCheckingInspection") class TriggerBTDeviceTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt index c761573b75..4bb36ae0c8 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt @@ -6,15 +6,15 @@ import info.nightscout.database.entities.GlucoseValue import info.nightscout.interfaces.GlucoseUnit import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerBgTest : TriggerTestBase() { var now = 1514766900000L - @Before + @BeforeEach fun prepare() { `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) `when`(dateUtil.now()).thenReturn(now) diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt index 4676677a3f..c27c6a321b 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt @@ -8,15 +8,15 @@ import io.reactivex.rxjava3.core.Single import org.json.JSONException import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerBolusAgoTest : TriggerTestBase() { var now = 1514766900000L - @Before + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerCOBTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerCOBTest.kt index 2eaed607c8..01874ea8a6 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerCOBTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerCOBTest.kt @@ -5,8 +5,8 @@ import info.nightscout.automation.elements.Comparator import info.nightscout.interfaces.iob.CobInfo import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mockito.`when` @@ -14,7 +14,7 @@ class TriggerCOBTest : TriggerTestBase() { var now = 1514766900000L - @Before fun mock() { + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) `when`(sp.getInt(ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt())).thenReturn(48) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt index 388124a452..a863393ed2 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerConnectorTest.kt @@ -3,7 +3,7 @@ package info.nightscout.automation.triggers import org.json.JSONException import org.json.JSONObject import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class TriggerConnectorTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt index 50007685a7..f5f636028a 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt @@ -8,15 +8,15 @@ import info.nightscout.database.entities.GlucoseValue import info.nightscout.interfaces.GlucoseUnit import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerDeltaTest : TriggerTestBase() { var now = 1514766900000L - @Before + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDummyTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDummyTest.kt index 5553062367..cac3ac5943 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDummyTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerDummyTest.kt @@ -2,7 +2,7 @@ package info.nightscout.automation.triggers import org.json.JSONObject import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class TriggerDummyTest : TriggerTestBase() { diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerIobTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerIobTest.kt index 32033a643d..eae273ffd5 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerIobTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerIobTest.kt @@ -6,8 +6,8 @@ import info.nightscout.automation.elements.Comparator import info.nightscout.interfaces.iob.IobTotal import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mockito.`when` @@ -15,7 +15,7 @@ class TriggerIobTest : TriggerTestBase() { var now = 1514766900000L - @Before fun mock() { + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) `when`(profileFunction.getProfile()).thenReturn(validProfile) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerLocationTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerLocationTest.kt index c2881bb524..ffd03c950d 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerLocationTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerLocationTest.kt @@ -7,15 +7,15 @@ import info.nightscout.automation.elements.InputLocationMode import org.json.JSONException import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerLocationTest : TriggerTestBase() { var now = 1514766900000L - @Before fun mock() { + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) `when`(locationDataContainer.lastLocation).thenReturn(mockedLocation()) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerProfilePercentTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerProfilePercentTest.kt index 6006fc7ed5..751078035f 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerProfilePercentTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerProfilePercentTest.kt @@ -5,15 +5,15 @@ import info.nightscout.automation.R import info.nightscout.automation.elements.Comparator import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerProfilePercentTest : TriggerTestBase() { private val now = 1514766900000L - @Before fun mock() { + @BeforeEach fun mock() { `when`(profileFunction.getProfile()).thenReturn(validProfile) `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerPumpLastConnectionTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerPumpLastConnectionTest.kt index b29c0bde46..48493edf3a 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerPumpLastConnectionTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerPumpLastConnectionTest.kt @@ -5,15 +5,15 @@ import info.nightscout.automation.R import info.nightscout.automation.elements.Comparator import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerPumpLastConnectionTest : TriggerTestBase() { var now = 1514766900000L - @Before + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerRecurringTimeTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerRecurringTimeTest.kt index 94ae1bc1ec..eaf718e3ec 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerRecurringTimeTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerRecurringTimeTest.kt @@ -4,15 +4,15 @@ import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.shared.utils.T import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerRecurringTimeTest : TriggerTestBase() { var now: Long = 0L - @Before fun mock() { + @BeforeEach fun mock() { now = MidnightTime.calc() + T.mins(95).msecs() // 95 min from midnight `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetTest.kt index 989f1b41ac..13c8960f76 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetTest.kt @@ -5,15 +5,15 @@ import info.nightscout.automation.R import info.nightscout.automation.elements.ComparatorExists import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerTempTargetTest : TriggerTestBase() { var now = 1514766900000L - @Before fun mock() { + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt index 575f196eaf..c55f9aa73d 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt @@ -9,15 +9,15 @@ import info.nightscout.interfaces.GlucoseUnit import io.reactivex.rxjava3.core.Single import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerTempTargetValueTest : TriggerTestBase() { var now = 1514766900000L - @Before + @BeforeEach fun prepare() { `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) `when`(dateUtil.now()).thenReturn(now) diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTestBase.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTestBase.kt index 1b47de9913..9141d549fc 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTestBase.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTestBase.kt @@ -5,17 +5,17 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestPumpPlugin -import info.nightscout.core.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.automation.AutomationPlugin import info.nightscout.automation.services.LastLocationDataContainer -import info.nightscout.interfaces.receivers.ReceiverStatusStore +import info.nightscout.core.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.interfaces.aps.AutosensDataStore import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginDescription +import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.rx.bus.RxBus import info.nightscout.shared.sharedPreferences.SP -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.Mock import org.mockito.Mockito.`when` @@ -32,7 +32,7 @@ open class TriggerTestBase : TestBaseWithProfile() { private val pluginDescription = PluginDescription() lateinit var testPumpPlugin: TestPumpPlugin - @Before + @BeforeEach fun prepareMock1() { testPumpPlugin = TestPumpPlugin(pluginDescription, aapsLogger, rh, injector) `when`(activePlugin.activePump).thenReturn(testPumpPlugin) diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeRangeTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeRangeTest.kt index 636af3e650..37d6d3cddc 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeRangeTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeRangeTest.kt @@ -1,12 +1,12 @@ package info.nightscout.automation.triggers import com.google.common.base.Optional -import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.automation.R +import info.nightscout.interfaces.utils.MidnightTime import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerTimeRangeTest : TriggerTestBase() { @@ -14,7 +14,7 @@ class TriggerTimeRangeTest : TriggerTestBase() { var now = 754 // in minutes from midnight private var timeJson = "{\"data\":{\"start\":753,\"end\":784},\"type\":\"TriggerTimeRange\"}" - @Before + @BeforeEach fun mock() { val nowMills = MidnightTime.calcPlusMinutes(now) `when`(dateUtil.now()).thenReturn(nowMills) diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeTest.kt index 27fbd804bc..7d16d54d66 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerTimeTest.kt @@ -5,15 +5,15 @@ import info.nightscout.shared.utils.T import org.json.JSONException import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerTimeTest : TriggerTestBase() { var now = 1514766900000L - @Before fun mock() { + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerWifiSsidTest.kt b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerWifiSsidTest.kt index 61acd6a1ee..67326c8a08 100644 --- a/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerWifiSsidTest.kt +++ b/plugins/automation/src/test/java/info/nightscout/automation/triggers/TriggerWifiSsidTest.kt @@ -7,14 +7,15 @@ import info.nightscout.rx.events.EventNetworkChange import org.json.JSONException import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class TriggerWifiSsidTest : TriggerTestBase() { var now = 1514766900000L - @Before fun mock() { + + @BeforeEach fun mock() { `when`(dateUtil.now()).thenReturn(now) } diff --git a/plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..49bf9977d6 100644 --- a/plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/plugins/configuration/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -4,22 +4,20 @@ import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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) diff --git a/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt b/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt index d52806d895..f1ec506c4b 100644 --- a/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt +++ b/plugins/configuration/src/test/java/info/nightscout/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt @@ -13,14 +13,15 @@ import org.hamcrest.CoreMatchers import org.junit.Assert import org.junit.Assume import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito import java.io.File @Suppress("SpellCheckingInspection") -class EncryptedPrefsFormatTest : TestBase() { +open class EncryptedPrefsFormatTest : TestBase() { @Mock lateinit var rh: ResourceHelper @Mock lateinit var file: MockedFile @@ -37,7 +38,7 @@ class EncryptedPrefsFormatTest : TestBase() { } } - @Before + @BeforeEach fun mock() { Mockito.`when`(rh.gs(ArgumentMatchers.anyInt())).thenReturn("mock translation") } @@ -206,35 +207,39 @@ class EncryptedPrefsFormatTest : TestBase() { Assert.assertEquals(prefs.metadata[PrefsMetadataKey.FILE_FORMAT]?.status, PrefsStatus.ERROR) } - @Test(expected = PrefFormatError::class) + @Test fun garbageInputTest() { - val frozenPrefs = "whatever man, i duno care" + Assert.assertThrows(PrefFormatError::class.java) { + val frozenPrefs = "whatever man, i duno care" - val storage = SingleStringStorage(frozenPrefs) - val encryptedFormat = EncryptedPrefsFormat(rh, cryptoUtil, storage) - encryptedFormat.loadPreferences(getMockedFile(), "sikret") + val storage = SingleStringStorage(frozenPrefs) + val encryptedFormat = EncryptedPrefsFormat(rh, cryptoUtil, storage) + encryptedFormat.loadPreferences(getMockedFile(), "sikret") + } } - @Test(expected = PrefFormatError::class) + @Test fun unknownFormatTest() { - val frozenPrefs = "{\n" + - " \"metadata\": {},\n" + - " \"security\": {\n" + - " \"salt\": \"9581d7a9e56d8127ad6b74a876fa60b192b1c6f4343d857bc07e3874589f2fc9\",\n" + - " \"file_hash\": \"9122fd04a4938030b62f6b9d6dda63a11c265e673c4aecbcb6dcd62327c025bb\",\n" + - " \"content_hash\": \"23f999f6e6d325f649b61871fe046a94e110bf1587ff070fb66a0f8085b2760c\",\n" + - " \"algorithm\": \"v1\"\n" + - " },\n" + - " \"format\": \"aaps_9000_new_format\",\n" + - " \"content\": \"DJ5+HP/gq7icRQhbG9PEBJCMuNwBssIytfEQPCNkzn7PHMfMZuc09vYQg3qzFkmULLiotg==\"\n" + - "}" + Assert.assertThrows(PrefFormatError::class.java) { + val frozenPrefs = "{\n" + + " \"metadata\": {},\n" + + " \"security\": {\n" + + " \"salt\": \"9581d7a9e56d8127ad6b74a876fa60b192b1c6f4343d857bc07e3874589f2fc9\",\n" + + " \"file_hash\": \"9122fd04a4938030b62f6b9d6dda63a11c265e673c4aecbcb6dcd62327c025bb\",\n" + + " \"content_hash\": \"23f999f6e6d325f649b61871fe046a94e110bf1587ff070fb66a0f8085b2760c\",\n" + + " \"algorithm\": \"v1\"\n" + + " },\n" + + " \"format\": \"aaps_9000_new_format\",\n" + + " \"content\": \"DJ5+HP/gq7icRQhbG9PEBJCMuNwBssIytfEQPCNkzn7PHMfMZuc09vYQg3qzFkmULLiotg==\"\n" + + "}" - val storage = SingleStringStorage(frozenPrefs) - val encryptedFormat = EncryptedPrefsFormat(rh, cryptoUtil, storage) - encryptedFormat.loadPreferences(getMockedFile(), "sikret") + val storage = SingleStringStorage(frozenPrefs) + val encryptedFormat = EncryptedPrefsFormat(rh, cryptoUtil, storage) + encryptedFormat.loadPreferences(getMockedFile(), "sikret") + } } - class MockedFile(s: String) : File(s) + open class MockedFile(s: String) : File(s) private fun getMockedFile(): File { Mockito.`when`(file.exists()).thenReturn(true) diff --git a/plugins/main/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/main/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..4fd2aef548 100644 --- a/plugins/main/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/plugins/main/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index d94df05543..ef46cbe7e0 100644 --- a/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -17,7 +17,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers.anyDouble import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString @@ -48,7 +48,7 @@ open class TestBaseWithProfile : TestBase() { @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/plugins/main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/plugins/main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt index af18cd7321..b3cdd8a6f8 100644 --- a/plugins/main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt +++ b/plugins/main/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.Pump @@ -13,6 +14,7 @@ import info.nightscout.interfaces.utils.TimeChangeType import org.json.JSONObject @Suppress("MemberVisibilityCanBePrivate") +@OpenForTesting class TestPumpPlugin(val injector: HasAndroidInjector) : Pump { var connected = false diff --git a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt index 8abebcd622..dccee93785 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/ObjectivesPluginTest.kt @@ -13,8 +13,8 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -38,7 +38,7 @@ class ObjectivesPluginTest : TestBase() { } } - @Before fun prepareMock() { + @BeforeEach fun prepareMock() { objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config) objectivesPlugin.onStart() `when`(rh.gs(R.string.objectivenotstarted, 9)).thenReturn("Objective 9 not started") diff --git a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt index 2814ddd1ef..520bebd1b3 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/constraints/objectives/SntpClientTest.kt @@ -3,7 +3,7 @@ package info.nightscout.plugins.constraints.objectives import info.nightscout.androidaps.TestBase import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import kotlin.math.abs diff --git a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/AuthRequestTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/AuthRequestTest.kt index d60e0e9084..398ab06392 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/AuthRequestTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/AuthRequestTest.kt @@ -13,8 +13,8 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.doAnswer import org.mockito.Mockito.`when` @@ -43,7 +43,7 @@ class AuthRequestTest : TestBase() { private var sentSms: Sms? = null private var actionCalled = false - @Before fun prepareTests() { + @BeforeEach fun prepareTests() { `when`(rh.gs(R.string.sms_wrong_code)).thenReturn("Wrong code. Command cancelled.") doAnswer(Answer { invocation: InvocationOnMock -> sentSms = invocation.getArgument(0) diff --git a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsActionTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsActionTest.kt index 459880b988..a2c8f6d539 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsActionTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsActionTest.kt @@ -1,7 +1,7 @@ package info.nightscout.plugins.general.smsCommunicator import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class SmsActionTest { diff --git a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt index ecf35306d0..fe36868c62 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt @@ -39,8 +39,8 @@ import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import io.reactivex.rxjava3.core.Single import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers.anyString import org.mockito.ArgumentMatchers.eq @@ -87,7 +87,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { private lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin private var hasBeenRun = false - @Before fun prepareTests() { + @BeforeEach fun prepareTests() { val reading = GlucoseValue(raw = 0.0, noise = 0.0, value = 100.0, timestamp = 1514766900000, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN, trendArrow = GlucoseValue.TrendArrow.FLAT) val bgList: MutableList = ArrayList() bgList.add(reading) diff --git a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsTest.kt index 32037c6d04..5c6300c91c 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsTest.kt @@ -4,7 +4,7 @@ import android.telephony.SmsMessage import info.nightscout.androidaps.TestBase import info.nightscout.interfaces.smsCommunicator.Sms import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito import org.mockito.Mockito.`when` diff --git a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt index 50c9580415..0987238522 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinLyumjevPluginTest.kt @@ -11,20 +11,20 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import org.junit.Assert.assertEquals -import org.junit.Before -import org.junit.Rule -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.ArgumentMatchers.eq import org.mockito.Mock import org.mockito.Mockito.`when` -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) class InsulinLyumjevPluginTest { - @get:Rule - val mockitoRule: MockitoRule = MockitoJUnit.rule() - private lateinit var sut: InsulinLyumjevPlugin @Mock lateinit var rh: ResourceHelper @@ -39,7 +39,7 @@ class InsulinLyumjevPluginTest { } } - @Before + @BeforeEach fun setup() { sut = InsulinLyumjevPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt index 5025857ad2..5ad4a08781 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt @@ -13,14 +13,17 @@ import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import org.json.JSONObject import org.junit.Assert -import org.junit.Before -import org.junit.Rule -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) class InsulinOrefBasePluginTest { var testPeak = 0 @@ -54,9 +57,6 @@ class InsulinOrefBasePluginTest { override fun applyConfiguration(configuration: JSONObject) {} } - @get:Rule - val mockitoRule: MockitoRule = MockitoJUnit.rule() - private lateinit var sut: InsulinBaseTest @Mock lateinit var rh: ResourceHelper @@ -71,7 +71,7 @@ class InsulinOrefBasePluginTest { } } - @Before + @BeforeEach fun setUp() { sut = InsulinBaseTest(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) `when`(hardLimits.minDia()).thenReturn(5.0) diff --git a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt index 849123918f..0974ba91b5 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefFreePeakPluginTest.kt @@ -12,8 +12,8 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert.assertEquals -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.eq import org.mockito.Mock @@ -39,7 +39,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() { } } - @Before + @BeforeEach fun setup() { sut = InsulinOrefFreePeakPlugin(injector, sp, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt index 6107c8b23a..cf1898abcf 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefRapidActingPluginTest.kt @@ -11,20 +11,20 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import org.junit.Assert.assertEquals -import org.junit.Before -import org.junit.Rule -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.ArgumentMatchers.eq import org.mockito.Mock import org.mockito.Mockito.`when` -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) class InsulinOrefRapidActingPluginTest { - @get:Rule - val mockitoRule: MockitoRule = MockitoJUnit.rule() - private lateinit var sut: InsulinOrefRapidActingPlugin @Mock lateinit var rh: ResourceHelper @@ -39,7 +39,7 @@ class InsulinOrefRapidActingPluginTest { } } - @Before + @BeforeEach fun setup() { sut = InsulinOrefRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt index 5c0792dbee..9ae7fe1964 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/insulin/InsulinOrefUltraRapidActingPluginTest.kt @@ -11,20 +11,20 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import org.junit.Assert.assertEquals -import org.junit.Before -import org.junit.Rule -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.ArgumentMatchers.eq import org.mockito.Mock import org.mockito.Mockito.`when` -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) class InsulinOrefUltraRapidActingPluginTest { - @get:Rule - val mockitoRule: MockitoRule = MockitoJUnit.rule() - private lateinit var sut: InsulinOrefUltraRapidActingPlugin @Mock lateinit var rh: ResourceHelper @@ -39,7 +39,7 @@ class InsulinOrefUltraRapidActingPluginTest { } } - @Before + @BeforeEach fun setup() { sut = InsulinOrefUltraRapidActingPlugin(injector, rh, profileFunction, rxBus, aapsLogger, config, hardLimits) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt index 1989444372..72cea74951 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/pump/virtual/VirtualPumpPluginUTest.kt @@ -15,8 +15,8 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -35,7 +35,7 @@ class VirtualPumpPluginUTest : TestBase() { lateinit var virtualPumpPlugin: VirtualPumpPlugin - @Before + @BeforeEach fun prepareMocks() { virtualPumpPlugin = VirtualPumpPlugin({ AndroidInjector { } }, aapsLogger, rxBus, fabricPrivacy, rh, aapsSchedulers, sp, profileFunction, iobCobCalculator, commandQueue, pumpSync, config, dateUtil) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/source/GlimpPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/source/GlimpPluginTest.kt index 43f2db608e..517ef7fed1 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/source/GlimpPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/source/GlimpPluginTest.kt @@ -7,8 +7,8 @@ import info.nightscout.plugins.source.GlimpPlugin import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock class GlimpPluginTest : TestBase() { @@ -18,7 +18,7 @@ class GlimpPluginTest : TestBase() { @Mock lateinit var rh: ResourceHelper @Mock lateinit var sp: SP - @Before + @BeforeEach fun setup() { glimpPlugin = GlimpPlugin(HasAndroidInjector { AndroidInjector { } }, rh, aapsLogger, sp) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/source/MM640GPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/source/MM640GPluginTest.kt index 85eec58373..5ef860f425 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/source/MM640GPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/source/MM640GPluginTest.kt @@ -7,8 +7,8 @@ import info.nightscout.plugins.source.MM640gPlugin import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock class MM640GPluginTest : TestBase() { @@ -18,7 +18,7 @@ class MM640GPluginTest : TestBase() { @Mock lateinit var rh: ResourceHelper @Mock lateinit var sp: SP - @Before + @BeforeEach fun setup() { mM640gPlugin = MM640gPlugin(HasAndroidInjector { AndroidInjector { } }, rh, aapsLogger, sp) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/source/NSClientPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/source/NSClientPluginTest.kt index 09d03f7482..6e74ff7be3 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/source/NSClientPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/source/NSClientPluginTest.kt @@ -3,12 +3,11 @@ package info.nightscout.androidaps.plugins.source import dagger.android.AndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.interfaces.Config -import info.nightscout.plugins.source.NSClientSourcePlugin import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock class NSClientPluginTest : TestBase() { @@ -19,7 +18,7 @@ class NSClientPluginTest : TestBase() { @Mock lateinit var sp: SP @Mock lateinit var config: Config - @Before + @BeforeEach fun setup() { nsClientSourcePlugin = info.nightscout.plugins.source.NSClientSourcePlugin({ AndroidInjector { } }, rh, aapsLogger, config) } diff --git a/plugins/main/src/test/java/info/nightscout/plugins/source/XdripPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/source/XdripPluginTest.kt index 946ad0f2c3..49ac33fc0f 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/source/XdripPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/source/XdripPluginTest.kt @@ -6,8 +6,8 @@ import info.nightscout.androidaps.TestBase import info.nightscout.plugins.source.XdripPlugin import info.nightscout.shared.interfaces.ResourceHelper import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock class XdripPluginTest : TestBase() { @@ -16,7 +16,7 @@ class XdripPluginTest : TestBase() { @Mock lateinit var rh: ResourceHelper - @Before + @BeforeEach fun setup() { xdripPlugin = XdripPlugin(HasAndroidInjector { AndroidInjector { } }, rh, aapsLogger) } diff --git a/plugins/support/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/support/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..49bf9977d6 100644 --- a/plugins/support/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/plugins/support/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -4,22 +4,20 @@ import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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) diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt index f55172d99e..6a688f40b4 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt @@ -14,8 +14,8 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.any import org.mockito.Mock import org.mockito.Mockito.anyInt @@ -34,7 +34,7 @@ class BgQualityCheckPluginTest : TestBase() { val injector = HasAndroidInjector { AndroidInjector { } } //private val autosensDataStore = AutosensDataStoreObject() - @Before + @BeforeEach fun mock() { plugin = BgQualityCheckPlugin( diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt index 279c0cb097..3d5a4b66c0 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/dstHelper/DstHelperPluginTest.kt @@ -8,8 +8,8 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import java.text.DateFormat import java.text.SimpleDateFormat @@ -28,13 +28,13 @@ class DstHelperPluginTest : TestBase() { private val injector = HasAndroidInjector { AndroidInjector { } } - @Before + @BeforeEach fun mock() { plugin = DstHelperPlugin(injector, aapsLogger, rh, sp, activePlugin, loop) } @Test - fun runTest() { + private fun runTest() { val tz = TimeZone.getTimeZone("Europe/Rome") TimeZone.setDefault(tz) var cal = Calendar.getInstance(tz, Locale.ITALIAN) diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt index 4ac0fdd3ec..22db14f1de 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/SignatureVerifierPluginTest.kt @@ -8,7 +8,7 @@ import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock class SignatureVerifierPluginTest : TestBase() { diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt index 9a352475ab..fe315e52f2 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/signatureVerifier/VersionCheckerUtilsKtTest.kt @@ -2,8 +2,8 @@ package info.nightscout.plugins.constraints.signatureVerifier import dagger.Lazy import info.nightscout.androidaps.TestBase -import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.Config +import info.nightscout.interfaces.receivers.ReceiverStatusStore import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.versionChecker.VersionCheckerUtils import info.nightscout.plugins.constraints.versionChecker.VersionCheckerUtilsImpl @@ -13,8 +13,8 @@ import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.junit.Assert.assertArrayEquals import org.junit.Assert.assertEquals -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.Mockito.anyString @@ -33,7 +33,7 @@ import org.mockito.Mockito.`when` @Mock lateinit var dateUtil: DateUtil @Mock lateinit var uiInteraction: UiInteraction - @Before fun setup() { + @BeforeEach fun setup() { versionCheckerUtils = VersionCheckerUtilsImpl(aapsLogger, sp, rh, config, receiverStatusStore, dateUtil, uiInteraction) } @@ -371,7 +371,7 @@ import org.mockito.Mockito.`when` verify(uiInteraction, times(1)).addNotification(anyInt(), anyString(), anyInt()) } - @Before + @BeforeEach fun `set time`() { `when`(dateUtil.now()).thenReturn(10000000000L) assertEquals(10000000000L, dateUtil.now()) diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt index 0497255a0b..8da1bcf2a5 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/storage/StorageConstraintPluginTest.kt @@ -8,8 +8,8 @@ import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.anyInt import org.mockito.Mockito.anyLong @@ -22,7 +22,7 @@ class StorageConstraintPluginTest : TestBase() { private lateinit var storageConstraintPlugin: StorageConstraintPlugin - @Before fun prepareMock() { + @BeforeEach fun prepareMock() { storageConstraintPlugin = StorageConstraintPlugin({ AndroidInjector { } }, aapsLogger, rh, uiInteraction) `when`(rh.gs(anyInt(), anyLong())).thenReturn("") } diff --git a/plugins/support/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt b/plugins/support/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt index cffea50d55..6473d14c58 100644 --- a/plugins/support/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt +++ b/plugins/support/src/test/java/info/nightscout/plugins/constraints/versionChecker/AllowedVersionsTest.kt @@ -8,7 +8,7 @@ import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertNull import org.junit.Assert.assertTrue -import org.junit.Test +import org.junit.jupiter.api.Test class AllowedVersionsTest { diff --git a/plugins/sync/src/test/java/info/nightscout/androidaps/TestBase.kt b/plugins/sync/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..49bf9977d6 100644 --- a/plugins/sync/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/plugins/sync/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -4,22 +4,20 @@ import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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) diff --git a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclient/NsClientReceiverDelegateTest.kt b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclient/NsClientReceiverDelegateTest.kt index 62226f82e0..d873b86714 100644 --- a/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclient/NsClientReceiverDelegateTest.kt +++ b/plugins/sync/src/test/java/info/nightscout/plugins/sync/nsclient/NsClientReceiverDelegateTest.kt @@ -10,8 +10,8 @@ import info.nightscout.rx.events.EventNetworkChange import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -26,7 +26,7 @@ class NsClientReceiverDelegateTest : TestBase() { private lateinit var sut: NsClientReceiverDelegate - @Before + @BeforeEach fun prepare() { //receiverStatusStore = ReceiverStatusStore(context, rxBus) sut = NsClientReceiverDelegate(rxBus, rh, sp, receiverStatusStore) diff --git a/plugins/sync/src/test/java/info/nightscout/plugins/sync/tidepool/comm/SessionTest.kt b/plugins/sync/src/test/java/info/nightscout/plugins/sync/tidepool/comm/SessionTest.kt index 2d6175f3c0..95046acef1 100644 --- a/plugins/sync/src/test/java/info/nightscout/plugins/sync/tidepool/comm/SessionTest.kt +++ b/plugins/sync/src/test/java/info/nightscout/plugins/sync/tidepool/comm/SessionTest.kt @@ -4,7 +4,7 @@ import info.nightscout.plugins.sync.tidepool.messages.AuthReplyMessage import info.nightscout.plugins.sync.tidepool.messages.DatasetReplyMessage import org.junit.Assert.assertEquals import org.junit.Assert.assertNull -import org.junit.Test +import org.junit.jupiter.api.Test class SessionTest { diff --git a/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt index 046d5452fd..118c6533a1 100644 --- a/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt +++ b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt @@ -18,8 +18,8 @@ import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -45,7 +45,7 @@ class ComboPluginTest : TestBase() { private lateinit var comboPlugin: ComboPlugin - @Before + @BeforeEach fun prepareMocks() { `when`(rh.gs(R.string.no_valid_basal_rate)).thenReturn("No valid basal rate read from pump") `when`(context.getString(R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump") diff --git a/pump/combo/src/test/java/info/nightscout/pump/combo/TestBase.kt b/pump/combo/src/test/java/info/nightscout/pump/combo/TestBase.kt index aa1fefaeda..8372cd9648 100644 --- a/pump/combo/src/test/java/info/nightscout/pump/combo/TestBase.kt +++ b/pump/combo/src/test/java/info/nightscout/pump/combo/TestBase.kt @@ -3,25 +3,23 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale @Suppress("SpellCheckingInspection") +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/pump/dana/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/dana/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..4fd2aef548 100644 --- a/pump/dana/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/dana/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 2d4a3e662b..76235287ed 100644 --- a/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/pump/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -12,7 +12,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.Mock @Suppress("SpellCheckingInspection") @@ -36,7 +36,7 @@ open class TestBaseWithProfile : TestBase() { private lateinit var validProfileJSON: String @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/pump/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt b/pump/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt index 70ede295c5..2c874d7f48 100644 --- a/pump/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt +++ b/pump/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt @@ -5,8 +5,8 @@ import info.nightscout.interfaces.profile.ProfileInstantiator import info.nightscout.pump.dana.DanaPump import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock class DanaPumpTest : TestBaseWithProfile() { @@ -16,7 +16,7 @@ class DanaPumpTest : TestBaseWithProfile() { private lateinit var sut: DanaPump - @Before + @BeforeEach fun setup() { sut = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) } diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt index f50c942a17..8382df3772 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.kt @@ -6,6 +6,7 @@ import android.content.Intent import android.content.ServiceConnection import android.os.IBinder import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService import info.nightscout.androidaps.danar.AbstractDanaRPlugin import info.nightscout.androidaps.danar.R @@ -41,6 +42,7 @@ import kotlin.math.abs import kotlin.math.max @Singleton +@OpenForTesting class DanaRKoreanPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index b42900a855..962ca56965 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -12,6 +12,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.annotations.OpenForTesting; import info.nightscout.androidaps.danaRv2.services.DanaRv2ExecutionService; import info.nightscout.androidaps.danar.AbstractDanaRPlugin; import info.nightscout.androidaps.danar.R; @@ -44,6 +45,7 @@ import info.nightscout.shared.utils.T; import io.reactivex.rxjava3.disposables.CompositeDisposable; @Singleton +@OpenForTesting public class DanaRv2Plugin extends AbstractDanaRPlugin { private final CompositeDisposable disposable = new CompositeDisposable(); diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 6a79cf3393..2d2a03286b 100644 --- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -12,6 +12,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.annotations.OpenForTesting; import info.nightscout.androidaps.danar.services.DanaRExecutionService; import info.nightscout.core.utils.fabric.FabricPrivacy; import info.nightscout.interfaces.constraints.Constraint; @@ -40,6 +41,7 @@ import info.nightscout.shared.utils.DateUtil; import io.reactivex.rxjava3.disposables.CompositeDisposable; @Singleton +@OpenForTesting public class DanaRPlugin extends AbstractDanaRPlugin { private final CompositeDisposable disposable = new CompositeDisposable(); diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/danar/src/test/java/info/nightscout/androidaps/TestBase.kt index aa1fefaeda..c56bdc19a8 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,25 +3,23 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale @Suppress("SpellCheckingInspection") +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") @@ -36,5 +34,5 @@ open class TestBase { } @Suppress("Unchecked_Cast") - fun uninitialized(): T = null as T + private fun uninitialized(): T = null as T } \ No newline at end of file diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 4de6fb97d3..e801e3f513 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -15,7 +15,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers.anyDouble import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString @@ -44,7 +44,7 @@ open class TestBaseWithProfile : TestBase() { @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index a277b21e68..a41fd92246 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -17,8 +17,8 @@ import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -40,7 +40,7 @@ class DanaRPluginTest : TestBaseWithProfile() { AndroidInjector { } } - @Before + @BeforeEach fun prepareMocks() { `when`(sp.getString(R.string.key_danars_address, "")).thenReturn("") `when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit") diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt index 5b04925591..8e40bf2cae 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt @@ -23,12 +23,12 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito.anyBoolean -import org.mockito.Mockito.doNothing import org.mockito.Mockito.`when` +import org.mockito.kotlin.doNothing open class DanaRTestBase : TestBase() { @@ -51,13 +51,15 @@ open class DanaRTestBase : TestBase() { private lateinit var testPumpPlugin: TestPumpPlugin - @Before + @BeforeEach fun setup() { danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) testPumpPlugin = TestPumpPlugin(injector) `when`(activePlugin.activePump).thenReturn(testPumpPlugin) doNothing().`when`(danaRKoreanPlugin).setPluginEnabled(anyObject(), anyBoolean()) doNothing().`when`(danaRPlugin).setPluginEnabled(anyObject(), anyBoolean()) + doNothing().`when`(danaRKoreanPlugin).setFragmentVisible(anyObject(), anyBoolean()) + doNothing().`when`(danaRPlugin).setFragmentVisible(anyObject(), anyBoolean()) `when`(rh.gs(ArgumentMatchers.anyInt())).thenReturn("") } diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt index 1277865b0c..57818ee8a7 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MessageHashTableR import info.nightscout.interfaces.constraints.Constraint import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito class MessageHashTableRTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt index beca8d68d5..bdfa17fc8c 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.danar.comm.MessageOriginalNames import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MessageOriginalNamesTest : TestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt index 7b4ba8523a..bd72916ce4 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.danar.comm.MsgBolusProgress import info.nightscout.rx.events.EventOverviewBolusProgress import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mockito.`when` diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt index 5c437e4fa9..c712530d67 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgBolusStart import info.nightscout.interfaces.constraints.Constraint import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class MsgBolusStartTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt index 0660d978af..b0c08a8202 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed import info.nightscout.interfaces.constraints.Constraint import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito class MsgBolusStartWithSpeedTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt index 79b4a7a460..5c92fbe378 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.danar.comm.MsgBolusStop import info.nightscout.rx.events.EventOverviewBolusProgress import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class MsgBolusStopTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt index c47b182fe7..ba9cfb8f55 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgCheckValue import info.nightscout.pump.dana.DanaPump import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgCheckValueTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt index ec678cda21..f5a010e91b 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgError import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgErrorTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt index baac96b341..5fd105a74c 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryAlarmTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt index 9177446e61..f25e096191 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryAllDone import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryAllDoneTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt index a10127dd38..616e6bf678 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryAll import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryAllTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt index 4d53cff893..acac58a3d3 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryBasalHourTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt index 0e43c3fd94..7325b5a4fb 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryBolus -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryBolusTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt index 61e543b1e2..f9ad642608 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryCarboTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt index a860b309c3..b574facc20 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryDailyInsulinTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt index cb7c30f9fc..c07265501c 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryDone -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryDoneTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt index dd1ec5f59a..29f59bbfb0 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryError -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryErrorTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt index e3a3ad3ddb..62004c79dd 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryGlucoseTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt index 5c8c4da006..756d1087e6 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryNewDone -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryNewDoneTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt index 1bc690ffdf..14ffd6e4dc 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryNew -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryNewTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt index a8fa3704c0..1f3c5172ee 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryRefill -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryRefillTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt index b3b5774cd9..d113fd851f 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistorySuspend -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistorySuspendTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt index cc6a16da3f..422c5a47b7 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBasic import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgInitConnStatusBasicTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt index 2171701f7d..4742e5386c 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBolus import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgInitConnStatusBolusTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt index 2ce904bfa4..0f4ca09684 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgInitConnStatusOption import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgInitConnStatusOptionTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt index b518d8ae92..122543defe 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgInitConnStatusTime import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgInitConnStatusTimeTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt index 9f51769c58..79e99f5c73 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgPCCommStart -import org.junit.Test +import org.junit.jupiter.api.Test class MsgPCCommStartTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt index ef1f6555c2..7db7ab28f3 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgPCCommStop -import org.junit.Test +import org.junit.jupiter.api.Test class MsgPCCommStopTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt index 30835645f2..a75ce2dbc5 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetActivateBasalProfile import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetActivateBasalProfileTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt index be82e6eb37..f754bed976 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetBasalProfileTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt index 9b508b0514..d6d592c4c1 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetCarbsEntryTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt index ff068be94c..e37d9df817 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart import info.nightscout.interfaces.constraints.Constraint import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class MsgSetExtendedBolusStartTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt index af3b58f2ea..8ced436daa 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetExtendedBolusStopTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt index b959f2b9f9..d7efc0e098 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetSingleBasalProfile import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetSingleBasalProfileTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt index 8d532863c6..d3c15c140a 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetTempBasalStartTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt index 088469ab64..d1a5e22c13 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetTime import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetTimeTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt index fe325d8aa3..a95ef72c0e 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetUserOptions import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetUserOptionsTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt index b19085f7f3..a0ba4f4ff3 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingActiveProfileTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt index 746a0b197f..af9c6b27e0 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingBasalProfileAll -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingBasalProfileAllTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt index 226da3f35d..d150689867 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingBasal import info.nightscout.interfaces.pump.defs.PumpDescription import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class MsgSettingBasalTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt index 7939e5a26b..11128cc86d 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingGlucose import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingGlucoseTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt index 206e578bea..796b76185d 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingMaxValues import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingMaxValuesTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt index ac21cfe082..33ca9eb1dc 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingMeal import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingMealTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt index 98b063c59b..c208a77145 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll import info.nightscout.pump.dana.DanaPump import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingProfileRatiosAllTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt index 26de1b98f7..df59bd000f 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios import info.nightscout.pump.dana.DanaPump import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingProfileRatiosTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt index 6fbd695660..e63453ec6f 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime import info.nightscout.pump.dana.DanaPump import org.joda.time.DateTime import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingPumpTimeTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt index afb5a150dd..f14e8e47de 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo import info.nightscout.pump.dana.DanaPump import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingShippingInfoTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt index 4ad11364ea..ff25f411b8 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions import info.nightscout.pump.dana.DanaPump import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSettingUserOptionsTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt index 939eb466f7..21e9eb565b 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgStatusBasic import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgStatusBasicTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt index e471c7f4d9..75957a7e9a 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended import info.nightscout.shared.utils.T import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgStatusBolusExtendedTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt index 54b919d126..7e46941a4e 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgStatusProfile import info.nightscout.pump.dana.DanaPump import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgStatusProfileTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt index 06cd1c5863..7e525b9609 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgStatusTempBasalTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt index f8161b507d..68a0763d26 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgStatus import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgStatusTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt index d1e68a9a61..c47b5f84d0 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.pump.dana.comm.RecordTypes import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class RecordTypesTest { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index fcd254b47d..c5f6c7b1c2 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -17,8 +17,8 @@ import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -40,7 +40,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() { AndroidInjector { } } - @Before + @BeforeEach fun prepareMocks() { `when`(sp.getString(R.string.key_danars_address, "")).thenReturn("") `when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit") diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt index cb0d8752cc..3899f83c7b 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.interfaces.constraints.Constraint import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito class MessageHashTableRKoreanTest : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index 2355da4324..a80eda2d8e 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -18,8 +18,8 @@ import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.shared.sharedPreferences.SP -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` @@ -43,7 +43,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() { AndroidInjector { } } - @Before + @BeforeEach fun prepareMocks() { `when`(sp.getString(R.string.key_danars_address, "")).thenReturn("") `when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit") diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt index 782c123942..981a642288 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt @@ -6,7 +6,7 @@ import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.interfaces.constraints.Constraint import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` class MessageHashTableRv2Test : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt index 59e9e31047..5bfac64677 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.danaRv2.comm.MsgCheckValue_v2 import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.pump.dana.DanaPump import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgCheckValueRv2Test : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt index 82655d092b..625c3f8551 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.danaRv2.comm.MsgHistoryEventsV2 import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgHistoryEventsRv2Test : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt index d55fb9ddb5..8a60c4f7b9 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2 import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetAPSTempBasalStartRv2Test : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt index 5f33449601..e80d8a62de 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.danaRv2.comm.MsgSetHistoryEntry_v2 import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgSetHistoryEntryRv2Test : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt index 396634f042..54686e80cb 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2 import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class MsgStatusAPSRv2Test : DanaRTestBase() { diff --git a/pump/danar/src/test/java/info/nightscout/androidaps/utils/CRCTest.kt b/pump/danar/src/test/java/info/nightscout/androidaps/utils/CRCTest.kt index b7ad2525c3..04dcdb1352 100644 --- a/pump/danar/src/test/java/info/nightscout/androidaps/utils/CRCTest.kt +++ b/pump/danar/src/test/java/info/nightscout/androidaps/utils/CRCTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.utils import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class CRCTest { diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/danars/src/test/java/info/nightscout/androidaps/TestBase.kt index aa1fefaeda..8372cd9648 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,25 +3,23 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale @Suppress("SpellCheckingInspection") +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index fb3b9399c7..529aebf36d 100644 --- a/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/pump/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -15,7 +15,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.Mock @Suppress("SpellCheckingInspection") @@ -40,7 +40,7 @@ open class TestBaseWithProfile : TestBase() { lateinit var validProfile: Profile @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt index 7dd5899780..16c47b7e77 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSPluginTest.kt @@ -12,8 +12,8 @@ import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.pump.dana.database.DanaHistoryDatabase import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.eq import org.mockito.Mock import org.mockito.Mockito @@ -55,7 +55,7 @@ class DanaRSPluginTest : DanaRSTestBase() { Assert.assertEquals("DanaRS: limitingpercentrate", c.getMostLimitedReasons(aapsLogger)) } - @Before + @BeforeEach fun prepareMocks() { Mockito.`when`(sp.getString(R.string.key_danars_address, "")).thenReturn("") Mockito.`when`(rh.gs(eq(R.string.limitingbasalratio), anyObject(), anyObject())).thenReturn("limitingbasalratio") diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt index c2d7bba1fc..49ca424f53 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/DanaRSTestBase.kt @@ -8,7 +8,7 @@ import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.danars.comm.DanaRSPacket import info.nightscout.shared.sharedPreferences.SP -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito @@ -23,7 +23,7 @@ open class DanaRSTestBase : TestBaseWithProfile() { lateinit var danaPump: DanaPump - @Before + @BeforeEach fun prepare() { Mockito.`when`(rh.gs(ArgumentMatchers.anyInt())).thenReturn("AnyString") } @@ -56,7 +56,7 @@ open class DanaRSTestBase : TestBaseWithProfile() { return array } - @Before + @BeforeEach fun setup() { danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator) } diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt index 13161e1a68..262c323afa 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRSPacketBasalSetTemporaryBasalTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketHistoryAlarmTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketHistoryAlarmTest.kt index d5e5e4d2c4..c7f6205250 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketHistoryAlarmTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketHistoryAlarmTest.kt @@ -6,7 +6,7 @@ import info.nightscout.pump.dana.comm.RecordTypes import info.nightscout.pump.dana.database.DanaHistoryRecordDao import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import java.util.GregorianCalendar diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt index d8f1202a7a..3bcb61b53e 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt @@ -6,7 +6,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.pump.danars.DanaRSTestBase import info.nightscout.rx.events.EventOverviewBolusProgress import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.anyDouble import org.mockito.Mockito.anyInt diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt index 660e37db6f..d1b0e9925e 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRSPacketOptionSetUserOptionTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsMessageHashTableTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsMessageHashTableTest.kt index 0efead6f8b..f812a5fd0c 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsMessageHashTableTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsMessageHashTableTest.kt @@ -8,7 +8,7 @@ import info.nightscout.interfaces.constraints.Constraints import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito.`when` diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt index c21a5c6ecb..32be1f8c64 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketApsBasalSetTemporaryBasalTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsHistoryEventsTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsHistoryEventsTest.kt index dbca566e40..1b0c2ea11f 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsHistoryEventsTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsHistoryEventsTest.kt @@ -9,7 +9,7 @@ import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.TemporaryBasalStorage import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import java.util.Calendar import java.util.GregorianCalendar diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt index e3e0a6ae3d..b611aa4a12 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketApsSetEventHistoryTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt index cc0b8e091d..a29c00cc10 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt index 4c1f40d53f..8980c38c99 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBasalGetProfileNumberTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt index 247bff6ced..6d0318cd9a 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBasalSetCancelTemporaryBasalTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt index 1a05e1c07c..edc043aa55 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBasalSetProfileBasalRateTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt index f1d9fa817a..0f9b958636 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBasalSetProfileNumberTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt index 0697f3e575..85b6eda703 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBasalSetSuspendOffTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt index c13808590f..1d29a42998 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBasalSetSuspendOnTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt index fdf806d4e4..b75fa764c7 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBolusGetBolusOptionTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt index 9622245e08..60c0b4989f 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBolusGetCalculationInformationTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt index 885351fd69..8bfe4cadc7 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.pump.dana.DanaPump import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBolusGetCirCfArrayTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt index de29cc1b2b..ff224927f7 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt @@ -4,7 +4,8 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Test import java.util.Calendar class DanaRsPacketBolusGetStepBolusInformationTest : DanaRSTestBase() { @@ -41,7 +42,7 @@ class DanaRsPacketBolusGetStepBolusInformationTest : DanaRSTestBase() { 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) + Assertions.assertEquals(12.5, danaPump.lastBolusAmount, 0.01) Assert.assertEquals(25.0, danaPump.maxBolus, 0.01) Assert.assertEquals(1.0, danaPump.bolusStep, 0.01) Assert.assertEquals("BOLUS__GET_STEP_BOLUS_INFORMATION", packet.friendlyName) diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt index f63d30b1d5..156b366b4b 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBolusSetBolusOptionTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt index 992ba385b6..e4b6939da2 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBolusSetExtendedBolusCancelTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt index 9686bb9cb7..764530a0f6 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketBolusSetExtendedBolusTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt index b64134039e..07e5ee8e58 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt @@ -12,8 +12,8 @@ import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito @@ -53,7 +53,7 @@ class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() { Assert.assertEquals("BOLUS__SET_STEP_BOLUS_START", packet.friendlyName) } - @Before + @BeforeEach fun mock() { danaRSPlugin = info.nightscout.pump.danars.DanaRSPlugin( diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt index f00ccab394..246116922e 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt @@ -6,7 +6,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.pump.danars.DanaRSTestBase import info.nightscout.rx.events.EventOverviewBolusProgress import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import org.mockito.Mockito import org.mockito.Mockito.`when` diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt index 0e8473facb..1750048ed9 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketEtcKeepConnectionTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt index 07ef31df47..917573f1ed 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketEtcSetHistorySaveTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt index 7a2b853a59..a967b13622 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketGeneralGetPumpCheckTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt index 7bea5e3f43..0f0d85fa87 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketGeneralGetShippingInformationTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt index dfb05e5904..54b867a2b9 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketGeneralGetShippingVersionTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt index b8c63772b0..0847d5df9c 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketGeneralGetUserTimeChangeFlagTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt index bb3b542d04..9cc7f72cdd 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketGeneralInitialScreenInformationTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt index 4ec0d8a43e..2a860ba6a9 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketGeneralSetHistoryUploadModeTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt index b06946e28f..07d85d5465 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketGeneralSetUserTimeChangeFlagClearTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt index a318da0223..b787ce81c4 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryAllHistoryTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBasalTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBasalTest.kt index 1bc42404c7..d4cd23d3b5 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBasalTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBasalTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryBasalTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt index 076219a0f1..5d04014ad1 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryBloodGlucoseTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBolusTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBolusTest.kt index 41b01753d5..a7befd750e 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBolusTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryBolusTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryBolusTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt index d9458804d5..568ed8d265 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryCarbohydrateTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryDailyTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryDailyTest.kt index 206216a3a1..426cb96f14 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryDailyTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryDailyTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryDailyTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryPrimeTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryPrimeTest.kt index 4ab753f6b0..820bf973ec 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryPrimeTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryPrimeTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryPrimeTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryRefillTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryRefillTest.kt index faac9f359e..224c4f0c83 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryRefillTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryRefillTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryRefillTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistorySuspendTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistorySuspendTest.kt index 0114075af2..1b531a261e 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistorySuspendTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistorySuspendTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistorySuspendTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryTemporaryTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryTemporaryTest.kt index 35fec655f6..0111158da6 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryTemporaryTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketHistoryTemporaryTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketHistoryTemporaryTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt index 115631bed5..e6654629b1 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyAlarmTest.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.interfaces.pump.PumpSync import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock class DanaRsPacketNotifyAlarmTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index c6a231682b..394d2c454b 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -12,8 +12,8 @@ import info.nightscout.pump.dana.database.DanaHistoryDatabase import info.nightscout.pump.danars.DanaRSTestBase import info.nightscout.rx.events.EventOverviewBolusProgress import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito.`when` @@ -57,7 +57,7 @@ class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { Assert.assertEquals("NOTIFY__DELIVERY_RATE_DISPLAY", packet.friendlyName) } - @Before + @BeforeEach fun mock() { danaRSPlugin = info.nightscout.pump.danars.DanaRSPlugin( diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt index b54ba03df8..5d65155dd4 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketNotifyMissedBolusAlarmTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt index 85ac89912c..5d66f09381 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.joda.time.DateTime import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketOptionGetPumpTimeTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt index 89b01b8cdd..d14a4e6968 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketOptionGetUserOptionTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt index 79a34c571e..45148f1832 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.joda.time.DateTime import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketOptionSetPumpTimeTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewBolusAvgTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewBolusAvgTest.kt index 256a29b4ef..98dfaddada 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewBolusAvgTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewBolusAvgTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketReviewBolusAvgTest : DanaRSTestBase() { diff --git a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt index 38d2865684..16bbfc797d 100644 --- a/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt +++ b/pump/danars/src/test/java/info/nightscout/pump/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt @@ -4,7 +4,7 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.pump.danars.DanaRSTestBase import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DanaRsPacketReviewGetPumpDecRatioTest : DanaRSTestBase() { diff --git a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.kt b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.kt index 9ab0f30eb9..17d0487958 100644 --- a/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.kt +++ b/pump/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic.driver +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem @@ -24,6 +25,7 @@ import javax.inject.Singleton * Created by andy on 4/28/18. */ @Singleton +@OpenForTesting class MedtronicPumpStatus @Inject constructor(private val rh: ResourceHelper, private val sp: SP, private val rxBus: RxBus, diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt index 0748da255e..b35c97800c 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -17,15 +17,18 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLoggerTest import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Answers import org.mockito.Mock import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) open class TestBase { val aapsLogger = AAPSLoggerTest() @@ -50,15 +53,7 @@ open class TestBase { } } - - - - // 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java index be499cdc97..8a5abed562 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicConverterUTest.java @@ -1,11 +1,11 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm; -import org.junit.Ignore; +import org.junit.jupiter.api.Disabled; /** * Created by andy on 1/30/19. */ -@Ignore +@Disabled public class MedtronicConverterUTest { /* MedtronicConverter converter = new MedtronicConverter(); diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt index c18ffd9de4..116f7dcbbc 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicHistoryDataUTest.kt @@ -16,8 +16,8 @@ import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.core.utils.ByteUtil import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.bus.RxBus -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock //import uk.org.lidalia.slf4jtest.TestLogger; @@ -38,7 +38,7 @@ class MedtronicHistoryDataUTest : TestBase() { lateinit var medtronicHistoryData: MedtronicHistoryData lateinit var medtronicPumpStatus: MedtronicPumpStatus - @Before + @BeforeEach fun setup() { rxBus = RxBus(TestAapsSchedulers(), aapsLogger) diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt index 2d169e2c0d..2aa891450a 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt @@ -9,8 +9,8 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.pump.core.utils.ByteUtil import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock /** @@ -31,7 +31,7 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() { //private var medtronicUtil: MedtronicUtil? = null //private var decoder: MedtronicPumpHistoryDecoder? = null - @Before fun setup() { + @BeforeEach fun setup() { medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil) medtronicUtil = diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt index 0cc748c7cd..8db522b625 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt @@ -10,8 +10,8 @@ import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.interfaces.ui.UiInteraction -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mock import java.lang.reflect.Type @@ -21,7 +21,7 @@ class MedtronicHistoryDataUTest : TestBase() { @Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus @Mock lateinit var uiInteraction: UiInteraction - @Before + @BeforeEach fun setUp() { medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, uiInteraction) decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil) diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java index 125e067164..9ac4f508a9 100644 --- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java +++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfileUTest.java @@ -1,16 +1,13 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data.dto; -import org.junit.Ignore; - -import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus; -import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; +import org.junit.jupiter.api.Disabled; /** * Created by andy on 6/16/18. */ //@RunWith(PowerMockRunner.class) //@PrepareForTest({ DatabaseHelper.class, DateUtil.class, SP.class }) -@Ignore +@Disabled public class BasalProfileUTest { /* @Before diff --git a/pump/omnipod-dash/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistoryTest.kt b/pump/omnipod-dash/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistoryTest.kt index b0739c0849..3ce25b2115 100644 --- a/pump/omnipod-dash/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistoryTest.kt +++ b/pump/omnipod-dash/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistoryTest.kt @@ -4,17 +4,14 @@ import android.content.Context import androidx.room.Room import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.github.guepardoapps.kulid.ULID import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordDao import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.mapper.HistoryMapper import info.nightscout.rx.logging.AAPSLoggerTest -import io.reactivex.rxjava3.schedulers.Schedulers -import org.junit.After import org.junit.Before -import org.junit.Rule -import org.junit.Test +import org.junit.jupiter.api.AfterEach +import org.junit.jupiter.api.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) @@ -24,9 +21,6 @@ class DashHistoryTest { private lateinit var database: DashHistoryDatabase private lateinit var dashHistory: DashHistory - @get:Rule - val schedulerRule = RxSchedulerRule(Schedulers.trampoline()) - @Before fun setUp() { val context = ApplicationProvider.getApplicationContext() @@ -68,7 +62,7 @@ class DashHistoryTest { } } - @After + @org.junit.jupiter.api.AfterEach fun tearDown() { database.close() } diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/TestBase.kt index ff9c66abeb..8372cd9648 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,25 +3,23 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule -import java.util.* +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness +import java.util.Locale @Suppress("SpellCheckingInspection") +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt index 7cef6f4bad..9b51dad2b2 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message. import info.nightscout.core.utils.toHex import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.spongycastle.util.encoders.Hex class EnDecryptTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt index 046e59a422..9b469e0bb9 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt @@ -4,7 +4,7 @@ import com.google.crypto.tink.subtle.Hex import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id import info.nightscout.core.utils.toHex import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test class MessagePacketTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt index 9be7d5848e..1f05069e30 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt @@ -4,7 +4,7 @@ import com.google.crypto.tink.subtle.Hex import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadJoiner import info.nightscout.core.utils.toHex import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test class PayloadJoinerTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt index 925899cb45..c0ea21e83a 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.P import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadSplitter import info.nightscout.core.utils.toHex import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test import java.util.Random class PayloadSplitJoinTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitterTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitterTest.kt index a702f1ce01..c0782f93ad 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitterTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitterTest.kt @@ -5,7 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.P import info.nightscout.core.utils.toHex import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue -import org.junit.Test +import org.junit.jupiter.api.Test class PayloadSplitterTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt index ad6bef32c3..f37ea00993 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message import com.google.crypto.tink.subtle.Hex import info.nightscout.core.utils.toHex import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test class StringLengthPrefixEncodingTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt index a1d34508a2..3c0d2cee19 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt @@ -7,7 +7,7 @@ import info.nightscout.core.utils.toHex import info.nightscout.interfaces.Config import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mock import org.mockito.Mockito diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt index 8e5ec3eaea..fd02883af1 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session import info.nightscout.core.utils.toHex import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.spongycastle.util.encoders.Hex class EapMessageTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt index c94fa401ba..6fc982fa53 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt @@ -5,7 +5,7 @@ import info.nightscout.core.utils.toHex import info.nightscout.interfaces.Config import info.nightscout.rx.logging.AAPSLoggerTest import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mock import org.spongycastle.util.encoders.Hex diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt index 6df505b0db..7ea25917f4 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DeactivateCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt index 38b0d98641..bb881aee36 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response. import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class GetStatusCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt index 20492004cb..d55d1f44d7 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class GetVersionCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt index 05b31e66f1..478f8ec19e 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt @@ -8,8 +8,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test -import java.util.* +import org.junit.jupiter.api.Test class ProgramAlertsCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt index 92daeed0b4..02b020dea9 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt @@ -5,8 +5,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test -import java.util.* +import org.junit.jupiter.api.Test +import java.util.Date @Suppress("DEPRECATION") class ProgramBasalCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt index 970e052e5c..55f3a8acb6 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt @@ -5,7 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ProgramBeepsCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt index 1069f86123..654527b612 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ProgramBolusCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt index 84bd7b3454..d18db30675 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class ProgramTempBasalCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt index 7fafa8de0d..2a36a2f61a 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test -import java.util.* +import org.junit.jupiter.api.Test +import java.util.Date class SetUniqueIdCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt index 910c518715..4f0d9b6d1d 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt @@ -4,8 +4,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test -import java.util.* +import org.junit.jupiter.api.Test +import java.util.EnumSet class SilenceAlertsCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt index e64fa539c3..bfc52cf531 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class StopDeliveryCommandTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt index 61ee84c330..225edbcf9b 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class SuspendDeliveryCommandTest { @Test @Throws(DecoderException::class) fun testSuspendDelivery() { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt index c57fb20a82..fa2817fc2c 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt @@ -6,7 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class AlarmStatusResponseTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt index d2a14907e9..a4ef9bbf56 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt @@ -6,7 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class DefaultStatusResponseTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt index b5254eca1d..a535486525 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt @@ -6,7 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class NakResponseTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt index 311be2c08b..4b3e3f474a 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class SetUniqueIdResponseTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt index 58e3585cae..66403fcb53 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import org.apache.commons.codec.DecoderException import org.apache.commons.codec.binary.Hex import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class VersionResponseTest { diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt index 1cd65f2d52..e6fdf49724 100644 --- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt +++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt @@ -5,7 +5,7 @@ import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.Profile.ProfileValue import org.junit.Assert import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test import org.mockito.Mockito import org.mockito.Mockito.`when` diff --git a/pump/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt b/pump/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt index 864050ecc7..c585f2552e 100644 --- a/pump/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt +++ b/pump/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt @@ -3,25 +3,21 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.history import android.content.Context import androidx.room.Room import androidx.test.core.app.ApplicationProvider -import androidx.test.ext.junit.runners.AndroidJUnit4 import info.nightscout.androidaps.plugins.pump.omnipod.eros.definition.PodHistoryEntryType import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryRecordDao import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryRecordEntity -import org.junit.After import org.junit.Assert.assertNotNull -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith +import org.junit.jupiter.api.AfterEach +import org.junit.jupiter.api.BeforeEach -@RunWith(AndroidJUnit4::class) class ErosHistoryTest { private lateinit var dao: ErosHistoryRecordDao private lateinit var database: ErosHistoryDatabase private lateinit var erosHistory: ErosHistory - @Before + @BeforeEach fun setUp() { val context = ApplicationProvider.getApplicationContext() database = Room.inMemoryDatabaseBuilder( @@ -51,7 +47,7 @@ class ErosHistoryTest { assert(type == returnedEntity?.podEntryTypeCode) } - @After + @AfterEach fun tearDown() { database.close() } diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..4fd2aef548 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt index 65f8113c2e..6b22e0dff4 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt @@ -20,8 +20,8 @@ import info.nightscout.shared.interfaces.ResourceHelper import org.joda.time.DateTimeZone import org.joda.time.tz.UTCProvider import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Answers import org.mockito.ArgumentMatchers import org.mockito.Mock @@ -43,7 +43,7 @@ class OmnipodErosPumpPluginTest : TestBase() { private var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger) - @Before fun prepare() { + @BeforeEach fun prepare() { `when`(rh.gs(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong())) .thenReturn("") } diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java index 0083504166..3a58e1934e 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java @@ -6,7 +6,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommandTest.java index 04e589d4b2..48b0589b04 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommandTest.java @@ -1,6 +1,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; -import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; + +import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -8,8 +10,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.Al import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertSlot; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.MessageBlockType; -import static org.junit.Assert.assertArrayEquals; - public class AcknowledgeAlertsCommandTest { @Test diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommandTest.java index 8680127290..89be0049eb 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommandTest.java @@ -1,9 +1,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; -import org.junit.Test; - import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; + public class AssignAddressCommandTest { @Test diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommandTest.java index 60733e458f..7419b7540c 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommandTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Collections; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommandTest.java index 995301fe6c..8aaf38fabd 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommandTest.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.BeepConfigType; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BolusExtraCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BolusExtraCommandTest.java index 7faacf7797..99e66aae7d 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BolusExtraCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BolusExtraCommandTest.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/CancelDeliveryCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/CancelDeliveryCommandTest.java index 1d00d152df..da4c4aa17a 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/CancelDeliveryCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/CancelDeliveryCommandTest.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.EnumSet; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommandTest.java index 7ad4116172..0a4e9502b7 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommandTest.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Collections; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommandTest.java index 397fc5a3f7..a889b3acc3 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommandTest.java @@ -1,11 +1,11 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; -import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; + +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.MessageBlockType; -import static org.junit.Assert.assertArrayEquals; - public class DeactivatePodCommandTest { @Test diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommandTest.java index b1074bc967..6700a65fe5 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommandTest.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetInsulinScheduleCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetInsulinScheduleCommandTest.java index c24f6822b2..0603937563 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetInsulinScheduleCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetInsulinScheduleCommandTest.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Collections; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetupPodCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetupPodCommandTest.java index 439c7c2384..de399e173a 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetupPodCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/SetupPodCommandTest.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; import org.joda.time.DateTime; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/TempBasalExtraCommandTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/TempBasalExtraCommandTest.java index 6cc543ec9b..173f2f0502 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/TempBasalExtraCommandTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/TempBasalExtraCommandTest.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertArrayEquals; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/defs/schedule/BasalTableEntryTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/defs/schedule/BasalTableEntryTest.java index 96569f6ffc..2ddc6d2376 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/defs/schedule/BasalTableEntryTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/defs/schedule/BasalTableEntryTest.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalTableEntry; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponseTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponseTest.java index 94eed25065..88271c76b7 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponseTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponseTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FaultEventCode; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/StatusResponseTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/StatusResponseTest.java index ac78f56da4..8bfa95fbb7 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/StatusResponseTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/StatusResponseTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertSlot; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.DeliveryStatus; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/VersionResponseTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/VersionResponseTest.java index d0bcb5b833..6eff4656c7 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/VersionResponseTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/VersionResponseTest.java @@ -7,7 +7,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoActiveAlertsTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoActiveAlertsTest.java index 617824448f..2ad48759b9 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoActiveAlertsTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoActiveAlertsTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDataLogTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDataLogTest.java index 91656418d6..fa3b871e1f 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDataLogTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDataLogTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FaultEventCode; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDetailedStatusTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDetailedStatusTest.java index 17f9f8c3aa..7b15263423 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDetailedStatusTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoDetailedStatusTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.DeliveryStatus; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ErrorEventInfo; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java index fe8a8a7c77..5712dbfca5 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoFaultAndInitializationTimeTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue; import org.joda.time.DateTime; import org.joda.time.Duration; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FaultEventCode; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoRecentPulseLogTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoRecentPulseLogTest.java index b782385dea..e2b7556b1a 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoRecentPulseLogTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoRecentPulseLogTest.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio import static org.junit.Assert.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.java index c420084fdb..c3e0caf36d 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.java @@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType; import info.nightscout.pump.core.utils.ByteUtil; diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSetTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSetTest.java index 9487978603..85a52012f6 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSetTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSetTest.java @@ -1,13 +1,13 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition; -import org.junit.Test; - -import java.util.Arrays; -import java.util.Collections; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; + public class AlertSetTest { @Test public void testEquality() { diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleTest.java index 8e0f3e11fd..538f0acd79 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleTest.java @@ -1,14 +1,14 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule; -import org.joda.time.Duration; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import org.joda.time.Duration; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + public class BasalScheduleTest { @Test public void testRateAt() { diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/util/TimeUtilTest.java b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/util/TimeUtilTest.java index 2c0704da42..37ebe5973c 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/util/TimeUtilTest.java +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/util/TimeUtilTest.java @@ -1,16 +1,16 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.util; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.junit.Before; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + public class TimeUtilTest { - @Before + @BeforeEach public void setUp() { DateTimeZone.setDefault(DateTimeZone.forID("Europe/Amsterdam")); } diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt index 678f32f135..f87a991cd3 100644 --- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt +++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt @@ -10,9 +10,9 @@ import org.joda.time.DateTime import org.joda.time.DateTimeUtils import org.joda.time.DateTimeZone import org.joda.time.Duration -import org.junit.After import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.AfterEach +import org.junit.jupiter.api.Test import org.mockito.Mock class AapsErosPodStateManagerTest : TestBase() { @@ -89,7 +89,7 @@ class AapsErosPodStateManagerTest : TestBase() { ) } - @After fun tearDown() { + @AfterEach fun tearDown() { DateTimeUtils.setCurrentMillisSystem() } } \ No newline at end of file diff --git a/pump/pump-common/src/main/java/info/nightscout/pump/common/sync/PumpSyncStorage.kt b/pump/pump-common/src/main/java/info/nightscout/pump/common/sync/PumpSyncStorage.kt index b997135870..e57056fbde 100644 --- a/pump/pump-common/src/main/java/info/nightscout/pump/common/sync/PumpSyncStorage.kt +++ b/pump/pump-common/src/main/java/info/nightscout/pump/common/sync/PumpSyncStorage.kt @@ -2,6 +2,7 @@ package info.nightscout.pump.common.sync import com.thoughtworks.xstream.XStream import com.thoughtworks.xstream.security.AnyTypePermission +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.PumpSync import info.nightscout.rx.logging.AAPSLogger @@ -15,6 +16,7 @@ import javax.inject.Singleton * This class is intended for Pump Drivers that use temporaryId and need way to pair records */ @Singleton +@OpenForTesting class PumpSyncStorage @Inject constructor( val pumpSync: PumpSync, val sp: SP, diff --git a/pump/rileylink/src/test/java/info/nightscout/androidaps/TestBase.kt b/pump/rileylink/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..4fd2aef548 100644 --- a/pump/rileylink/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/pump/rileylink/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt index bb2c050863..8572cab6b8 100644 --- a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt +++ b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class RFSpyTest : TestBase() { diff --git a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java index 5f7393d6bd..c8bf76503e 100644 --- a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java +++ b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsParametrizedUTest.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble; import android.util.Log; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -135,7 +135,7 @@ public class RFToolsParametrizedUTest { } - @Test + // @Test public void geoffDecode() throws Exception { Encoding4b6bGeoff decoder = new Encoding4b6bGeoff(null); @@ -145,7 +145,7 @@ public class RFToolsParametrizedUTest { } - @Test + // @Test public void geoffEncode() { Encoding4b6bGeoff decoder = new Encoding4b6bGeoff(null); diff --git a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java index 34700748bd..20d0a0eee7 100644 --- a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java +++ b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFToolsUTest.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Created by andy on 11/21/18. diff --git a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersionTest.java b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersionTest.java index 90351e7d89..3a83be2b61 100644 --- a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersionTest.java +++ b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RileyLinkFirmwareVersionTest.java @@ -1,10 +1,10 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs; -import org.junit.Test; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.junit.jupiter.api.Test; + public class RileyLinkFirmwareVersionTest { @Test diff --git a/ui/src/test/java/info/nightscout/androidaps/TestBase.kt b/ui/src/test/java/info/nightscout/androidaps/TestBase.kt index 03d778b101..4fd2aef548 100644 --- a/ui/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/ui/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -3,24 +3,22 @@ package info.nightscout.androidaps import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.logging.AAPSLoggerTest -import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) 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 + @BeforeEach fun setupLocale() { Locale.setDefault(Locale.ENGLISH) System.setProperty("disableFirebase", "true") diff --git a/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index cef4f2ddaf..194a53c0d4 100644 --- a/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -18,7 +18,7 @@ import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.utils.DateUtil import org.json.JSONObject -import org.junit.Before +import org.junit.jupiter.api.BeforeEach import org.mockito.ArgumentMatchers.anyDouble import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyString @@ -49,7 +49,7 @@ open class TestBaseWithProfile : TestBase() { @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" - @Before + @BeforeEach fun prepareMock() { validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," + "{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," + diff --git a/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt b/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt index 8ccfea4d65..e76ca0d19a 100644 --- a/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt +++ b/ui/src/test/java/info/nightscout/ui/defaultProfile/DefaultProfileTest.kt @@ -4,7 +4,7 @@ import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.core.profile.ProfileSealed import info.nightscout.interfaces.GlucoseUnit import org.junit.Assert.assertEquals -import org.junit.Test +import org.junit.jupiter.api.Test class DefaultProfileTest : TestBaseWithProfile() { diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Inevitable.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Inevitable.kt index e15958bc16..09659036aa 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Inevitable.kt +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Inevitable.kt @@ -1,10 +1,10 @@ package info.nightscout.androidaps.interaction.utils +import android.os.SystemClock import info.nightscout.androidaps.BuildConfig -import info.nightscout.shared.utils.DateUtil import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag - +import info.nightscout.shared.utils.DateUtil import java.util.concurrent.ConcurrentHashMap import javax.inject.Inject import javax.inject.Singleton @@ -52,7 +52,7 @@ class Inevitable @Inject internal constructor() { var running = true // wait for task to be due or killed while (running) { - wearUtil.threadSleep(500) + SystemClock.sleep(500) val thisTask = tasks[id] running = thisTask != null && !thisTask.poll() } diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.kt index b6e1868fde..557300ca6d 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.kt +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.kt @@ -1,14 +1,14 @@ package info.nightscout.androidaps.interaction.utils -import info.nightscout.shared.utils.DateUtil +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag - -import info.nightscout.shared.sharedPreferences.SP import info.nightscout.rx.weardata.EventData import info.nightscout.rx.weardata.EventData.Companion.deserialize import info.nightscout.rx.weardata.EventData.SingleBg import info.nightscout.rx.weardata.EventData.TreatmentData +import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.DateUtil import javax.inject.Inject import javax.inject.Singleton @@ -17,7 +17,8 @@ import javax.inject.Singleton * Refactored by MilosKozak 25/04/2022 */ @Singleton -class Persistence @Inject constructor( +@OpenForTesting +open class Persistence @Inject constructor( private val aapsLogger: AAPSLogger, private val dateUtil: DateUtil, private val sp: SP diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.kt index de994607db..927ed6bcdc 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.kt +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.interaction.utils import android.content.Context import android.os.PowerManager +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag @@ -13,18 +14,19 @@ import javax.inject.Singleton * Adapted by dlvoy on 2019-11-06 using code from jamorham JoH class */ @Singleton -class WearUtil @Inject constructor() { - - @Inject lateinit var context: Context - @Inject lateinit var aapsLogger: AAPSLogger +@OpenForTesting +open class WearUtil @Inject constructor( + open val context: Context, + open val aapsLogger: AAPSLogger +) { private val debugWakelocks = false - private val rateLimits: MutableMap = HashMap() + open val rateLimits: MutableMap = HashMap() //============================================================================================== // Time related util methods //============================================================================================== - fun timestamp(): Long { + open fun timestamp(): Long { return System.currentTimeMillis() } @@ -51,7 +53,7 @@ class WearUtil @Inject constructor() { return true } - fun getWakeLock(name: String, millis: Int): PowerManager.WakeLock { + open fun getWakeLock(name: String, millis: Int): PowerManager.WakeLock { val pm = context.getSystemService(Context.POWER_SERVICE) as PowerManager val wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AAPS::$name") wl.acquire(millis.toLong()) @@ -59,16 +61,8 @@ class WearUtil @Inject constructor() { return wl } - fun releaseWakeLock(wl: PowerManager.WakeLock?) { + open fun releaseWakeLock(wl: PowerManager.WakeLock?) { if (debugWakelocks) aapsLogger.debug(LTag.WEAR, "releaseWakeLock: " + wl.toString()) if (wl?.isHeld == true) wl.release() } - - fun threadSleep(millis: Long) { - try { - Thread.sleep(millis) - } catch (e: InterruptedException) { - // we simply ignore if sleep was interrupted - } - } } diff --git a/wear/src/test/java/info/nightscout/androidaps/TestBase.kt b/wear/src/test/java/info/nightscout/androidaps/TestBase.kt index 12adb1059f..c996ec07d5 100644 --- a/wear/src/test/java/info/nightscout/androidaps/TestBase.kt +++ b/wear/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -6,34 +6,41 @@ import info.nightscout.androidaps.interaction.utils.Persistence import info.nightscout.androidaps.interaction.utils.WearUtil import info.nightscout.androidaps.testing.mockers.WearUtilMocker import info.nightscout.androidaps.testing.mocks.SharedPreferencesMock -import info.nightscout.shared.utils.DateUtil import info.nightscout.rx.logging.AAPSLoggerTest import info.nightscout.shared.sharedPreferences.SP +import info.nightscout.shared.utils.DateUtil import org.junit.Before -import org.junit.Rule +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.extension.ExtendWith import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito -import org.mockito.junit.MockitoJUnit -import org.mockito.junit.MockitoRule +import org.mockito.Mockito.`when` +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.junit.jupiter.MockitoSettings +import org.mockito.quality.Strictness import java.util.Locale +@ExtendWith(MockitoExtension::class) +@MockitoSettings(strictness = Strictness.LENIENT) open class TestBase { @Mock lateinit var context: Context @Mock lateinit var sp: SP @Mock lateinit var dateUtil: DateUtil + @Mock lateinit var wearUtil: WearUtil val aapsLogger = AAPSLoggerTest() - val wearUtil: WearUtil = Mockito.spy(WearUtil()) - val wearUtilMocker = WearUtilMocker(wearUtil) + //val wearUtil: WearUtil = Mockito.mock(WearUtil::class.java) + lateinit var wearUtilMocker: WearUtilMocker lateinit var persistence: Persistence private val mockedSharedPrefs: HashMap = HashMap() - @Before + @BeforeEach fun setup() { + wearUtilMocker = WearUtilMocker(wearUtil) Mockito.doAnswer { invocation -> val key = invocation.getArgument(0) if (mockedSharedPrefs.containsKey(key)) { @@ -46,17 +53,14 @@ open class TestBase { }.`when`(context).getSharedPreferences(ArgumentMatchers.anyString(), ArgumentMatchers.anyInt()) wearUtilMocker.prepareMockNoReal() - wearUtil.aapsLogger = aapsLogger - wearUtil.context = context + `when`(wearUtil.aapsLogger).thenReturn(aapsLogger) + `when`(wearUtil.context).thenReturn(context) + val rateLimits: MutableMap = HashMap() + `when`(wearUtil.rateLimits).thenReturn(rateLimits) persistence = Mockito.spy(Persistence(aapsLogger, dateUtil, sp)) } - // 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) diff --git a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/DisplayFormatTest.kt b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/DisplayFormatTest.kt index 7ae16e3025..9b321c1a6c 100644 --- a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/DisplayFormatTest.kt +++ b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/DisplayFormatTest.kt @@ -4,8 +4,8 @@ import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.data.RawDisplayData import info.nightscout.androidaps.testing.mockers.RawDataMocker import org.junit.Assert -import org.junit.Before -import org.junit.Test +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test import org.mockito.Mockito /** @@ -17,7 +17,8 @@ class DisplayFormatTest : TestBase() { private lateinit var displayFormat: DisplayFormat private lateinit var rawDataMocker: RawDataMocker - @Before fun mock() { + @BeforeEach + fun mock() { rawDataMocker = RawDataMocker(wearUtil) wearUtilMocker.prepareMock() displayFormat = DisplayFormat() diff --git a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.kt b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.kt index 1f78b4a66d..19e427bcd8 100644 --- a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.kt +++ b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.interaction.utils import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test class PairTest { diff --git a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/WearUtilTest.kt b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/WearUtilTest.kt index a832b39139..19770e96b3 100644 --- a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/WearUtilTest.kt +++ b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/WearUtilTest.kt @@ -1,11 +1,9 @@ package info.nightscout.androidaps.interaction.utils -import com.google.android.gms.wearable.DataMap import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.testing.mockers.WearUtilMocker -import info.nightscout.androidaps.testing.mocks.BundleMock import org.junit.Assert -import org.junit.Test +import org.junit.jupiter.api.Test /** * Created by dlvoy on 22.11.2019. diff --git a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.kt b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.kt index e59164aee0..e5d17abaf3 100644 --- a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.kt +++ b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.kt @@ -1,10 +1,12 @@ package info.nightscout.androidaps.testing.mockers +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.interaction.utils.Constants import info.nightscout.androidaps.interaction.utils.WearUtil import org.mockito.ArgumentMatchers import org.mockito.Mockito +@OpenForTesting class WearUtilMocker(private val wearUtil: WearUtil) { private var clockMsDiff = 0L