From f20a1efe742be9f3f370990d3510c47c2e871016 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 19 Feb 2021 00:47:22 +0100 Subject: [PATCH] DanaR tests migration --- .../info/nightscout/androidaps/TestBase.kt | 40 +++++++++ .../androidaps/TestBaseWithProfile.kt | 82 +++++++++++++++++++ .../nightscout/androidaps/TestPumpPlugin.kt | 67 +++++++++++++++ .../plugins/pump/danaR/DanaRPluginTest.kt | 4 +- .../plugins/pump/danaR/comm/DanaRTestBase.kt | 19 +++-- .../pump/danaR/comm/MessageHashTableRTest.kt | 6 -- .../danaR/comm/MessageOriginalNamesTest.kt | 0 .../pump/danaR/comm/MsgBolusProgressTest.kt | 3 +- .../pump/danaR/comm/MsgBolusStartTest.kt | 0 .../danaR/comm/MsgBolusStartWithSpeedTest.kt | 0 .../pump/danaR/comm/MsgBolusStopTest.kt | 2 +- .../pump/danaR/comm/MsgCheckValueTest.kt | 0 .../plugins/pump/danaR/comm/MsgErrorTest.kt | 5 -- .../pump/danaR/comm/MsgHistoryAlarmTest.kt | 1 + .../pump/danaR/comm/MsgHistoryAllDoneTest.kt | 0 .../pump/danaR/comm/MsgHistoryAllTest.kt | 5 -- .../danaR/comm/MsgHistoryBasalHourTest.kt | 1 + .../pump/danaR/comm/MsgHistoryBolusTest.kt | 1 + .../pump/danaR/comm/MsgHistoryCarboTest.kt | 1 + .../danaR/comm/MsgHistoryDailyInsulinTest.kt | 1 + .../pump/danaR/comm/MsgHistoryDoneTest.kt | 1 + .../pump/danaR/comm/MsgHistoryErrorTest.kt | 1 + .../pump/danaR/comm/MsgHistoryGlucoseTest.kt | 1 + .../pump/danaR/comm/MsgHistoryNewDoneTest.kt | 1 + .../pump/danaR/comm/MsgHistoryNewTest.kt | 1 + .../pump/danaR/comm/MsgHistoryRefillTest.kt | 1 + .../pump/danaR/comm/MsgHistorySuspendTest.kt | 1 + .../danaR/comm/MsgInitConnStatusBasicTest.kt | 0 .../danaR/comm/MsgInitConnStatusBolusTest.kt | 0 .../danaR/comm/MsgInitConnStatusOptionTest.kt | 6 -- .../danaR/comm/MsgInitConnStatusTimeTest.kt | 6 -- .../pump/danaR/comm/MsgPCCommStartTest.kt | 0 .../pump/danaR/comm/MsgPCCommStopTest.kt | 0 .../comm/MsgSetActivateBasalProfileTest.kt | 0 .../pump/danaR/comm/MsgSetBasalProfileTest.kt | 0 .../pump/danaR/comm/MsgSetCarbsEntryTest.kt | 0 .../comm/MsgSetExtendedBolusStartTest.kt | 0 .../danaR/comm/MsgSetExtendedBolusStopTest.kt | 0 .../comm/MsgSetSingleBasalProfileTest.kt | 0 .../danaR/comm/MsgSetTempBasalStartTest.kt | 0 .../plugins/pump/danaR/comm/MsgSetTimeTest.kt | 0 .../pump/danaR/comm/MsgSetUserOptionsTest.kt | 0 .../danaR/comm/MsgSettingActiveProfileTest.kt | 0 .../comm/MsgSettingBasalProfileAllTest.kt | 0 .../pump/danaR/comm/MsgSettingBasalTest.kt | 0 .../pump/danaR/comm/MsgSettingGlucoseTest.kt | 0 .../danaR/comm/MsgSettingMaxValuesTest.kt | 0 .../pump/danaR/comm/MsgSettingMealTest.kt | 0 .../comm/MsgSettingProfileRatiosAllTest.kt | 0 .../danaR/comm/MsgSettingProfileRatiosTest.kt | 0 .../pump/danaR/comm/MsgSettingPumpTimeTest.kt | 2 +- .../danaR/comm/MsgSettingShippingInfoTest.kt | 0 .../danaR/comm/MsgSettingUserOptionsTest.kt | 0 .../pump/danaR/comm/MsgStatusBasicTest.kt | 0 .../danaR/comm/MsgStatusBolusExtendedTest.kt | 0 .../pump/danaR/comm/MsgStatusProfileTest.kt | 0 .../pump/danaR/comm/MsgStatusTempBasalTest.kt | 5 -- .../plugins/pump/danaR/comm/MsgStatusTest.kt | 0 .../pump/danaR/comm/RecordTypesTest.kt | 0 .../pump/danaRKorean/DanaRKoreanPluginTest.kt | 2 +- .../comm/MessageHashTableRKoreanTest.kt | 6 -- .../plugins/pump/danaRv2/DanaRv2PluginTest.kt | 2 +- .../danaRv2/comm/MessageHashTableRv2Test.kt | 7 +- .../pump/danaRv2/comm/MsgCheckValueRv2Test.kt | 8 +- .../danaRv2/comm/MsgHistoryEventsRv2Test.kt | 2 +- .../comm/MsgSetAPSTempBasalStartRv2Test.kt | 22 ++--- .../danaRv2/comm/MsgSetHistoryEntryRv2Test.kt | 2 +- .../pump/danaRv2/comm/MsgStatusAPSRv2Test.kt | 2 +- .../comm/MsgStatusBolusExtendedRv2Test.kt | 2 +- .../danaRv2/comm/MsgStatusTempBasalRv2Test.kt | 2 +- 70 files changed, 238 insertions(+), 83 deletions(-) create mode 100644 danar/src/test/java/info/nightscout/androidaps/TestBase.kt create mode 100644 danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt create mode 100644 danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt (96%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt (87%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt (64%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt (96%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt (95%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt (73%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt (91%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt (76%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt (92%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt (91%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt (91%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt (92%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt (91%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt (91%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt (92%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt (92%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt (91%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt (91%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt (92%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt (66%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt (61%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt (96%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt (71%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt (100%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt (98%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt (67%) rename {app => danar}/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt (98%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt (73%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt (58%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt (95%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt (63%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt (93%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt (94%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtendedRv2Test.kt (92%) rename app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt => danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasalRv2Test.kt (93%) diff --git a/danar/src/test/java/info/nightscout/androidaps/TestBase.kt b/danar/src/test/java/info/nightscout/androidaps/TestBase.kt new file mode 100644 index 0000000000..573c9dcbcc --- /dev/null +++ b/danar/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -0,0 +1,40 @@ +package info.nightscout.androidaps + +import info.nightscout.androidaps.logging.AAPSLoggerTest +import info.nightscout.androidaps.utils.rx.AapsSchedulers +import info.nightscout.androidaps.utils.rx.TestAapsSchedulers +import org.junit.Before +import org.junit.Rule +import org.mockito.Mockito +import org.mockito.junit.MockitoJUnit +import org.mockito.junit.MockitoRule +import java.util.* + +@Suppress("SpellCheckingInspection") +open class TestBase { + + val aapsLogger = AAPSLoggerTest() + val aapsSchedulers: AapsSchedulers = TestAapsSchedulers() + + // Add a JUnit rule that will setup the @Mock annotated vars and log. + // Another possibility would be to add `MockitoAnnotations.initMocks(this) to the setup method. + @get:Rule + val mockitoRule: MockitoRule = MockitoJUnit.rule() + + @Before + fun setupLocale() { + Locale.setDefault(Locale.ENGLISH) + System.setProperty("disableFirebase", "true") + } + + // Workaround for Kotlin nullability. + // https://medium.com/@elye.project/befriending-kotlin-and-mockito-1c2e7b0ef791 + // https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin + fun anyObject(): T { + Mockito.any() + return uninitialized() + } + + @Suppress("Unchecked_Cast") + fun uninitialized(): T = null as T +} \ No newline at end of file diff --git a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt new file mode 100644 index 0000000000..e3e5c7391b --- /dev/null +++ b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -0,0 +1,82 @@ +package info.nightscout.androidaps + +import dagger.android.AndroidInjector +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.Profile +import info.nightscout.androidaps.db.ProfileSwitch +import info.nightscout.androidaps.db.Treatment +import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ConfigInterface +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ProfileStore +import info.nightscout.androidaps.interfaces.TreatmentsInterface +import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.DefaultValueHelper +import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.resources.ResourceHelper +import org.json.JSONObject +import org.junit.Before +import org.mockito.Mock +import org.powermock.core.classloader.annotations.PrepareForTest + +@Suppress("SpellCheckingInspection") +@PrepareForTest(FabricPrivacy::class) +open class TestBaseWithProfile : TestBase() { + + @Mock lateinit var activePluginProvider: ActivePluginProvider + @Mock lateinit var resourceHelper: ResourceHelper + @Mock lateinit var treatmentsInterface: TreatmentsInterface + @Mock lateinit var fabricPrivacy: FabricPrivacy + @Mock lateinit var profileFunction: ProfileFunction + @Mock lateinit var defaultValueHelper: DefaultValueHelper + @Mock lateinit var dateUtil: DateUtil + @Mock lateinit var configInterface: ConfigInterface + + val rxBus = RxBusWrapper(aapsSchedulers) + + val profileInjector = HasAndroidInjector { + AndroidInjector { + if (it is Profile) { + it.aapsLogger = aapsLogger + it.activePlugin = activePluginProvider + it.resourceHelper = resourceHelper + it.rxBus = rxBus + it.fabricPrivacy = fabricPrivacy + it.configInterface = configInterface + } + if (it is ProfileSwitch) { + it.treatmentsPlugin = treatmentsInterface + it.aapsLogger = aapsLogger + it.rxBus = rxBus + it.resourceHelper = resourceHelper + it.dateUtil = dateUtil + } + if (it is Treatment) { + it.activePlugin = activePluginProvider + it.profileFunction = profileFunction + it.defaultValueHelper = defaultValueHelper + it.resourceHelper = resourceHelper + } + } + } + + private lateinit var validProfileJSON: String + lateinit var validProfile: Profile + @Suppress("PropertyName") val TESTPROFILENAME = "someProfile" + + @Before + fun prepareMock() { + validProfileJSON = "{\"dia\":\"3\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"100\"},{\"time\":\"2:00\",\"value\":\"110\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}" + validProfile = Profile(profileInjector, JSONObject(validProfileJSON), Constants.MGDL) + } + + fun getValidProfileStore(): ProfileStore { + val json = JSONObject() + val store = JSONObject() + store.put(TESTPROFILENAME, JSONObject(validProfileJSON)) + json.put("defaultProfile", TESTPROFILENAME) + json.put("store", store) + return ProfileStore(profileInjector, json) + } +} \ No newline at end of file diff --git a/danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt b/danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt new file mode 100644 index 0000000000..97727ab5af --- /dev/null +++ b/danar/src/test/java/info/nightscout/androidaps/TestPumpPlugin.kt @@ -0,0 +1,67 @@ +package info.nightscout.androidaps + +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.DetailedBolusInfo +import info.nightscout.androidaps.data.Profile +import info.nightscout.androidaps.data.PumpEnactResult +import info.nightscout.androidaps.interfaces.PumpDescription +import info.nightscout.androidaps.interfaces.PumpInterface +import info.nightscout.androidaps.plugins.common.ManufacturerType +import info.nightscout.androidaps.plugins.pump.common.defs.PumpType +import info.nightscout.androidaps.utils.TimeChangeType +import org.json.JSONObject + +@Suppress("MemberVisibilityCanBePrivate") +class TestPumpPlugin(val injector: HasAndroidInjector) : PumpInterface { + + var connected = false + var isProfileSet = true + + override fun isConnected() = connected + override fun isConnecting() = false + override fun isHandshakeInProgress() = false + val lastData = 0L + + val baseBasal = 0.0 + override val pumpDescription = PumpDescription() + + override fun isInitialized(): Boolean = true + override fun isSuspended(): Boolean = false + override fun isBusy(): Boolean = false + override fun connect(reason: String) { + connected = true + } + + override fun disconnect(reason: String) { + connected = false + } + + override fun stopConnecting() { + connected = false + } + + override fun waitForDisconnectionInSeconds(): Int = 0 + override fun getPumpStatus(reason: String) {} + override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResult(injector) + override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet + override fun lastDataTime(): Long = lastData + override val baseBasalRate: Double = baseBasal + override val reservoirLevel: Double = 0.0 + override val batteryLevel: Int = 0 + override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResult(injector).success(true) + override fun stopBolusDelivering() {} + override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean): PumpEnactResult = PumpEnactResult(injector).success(true) + override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean): PumpEnactResult = PumpEnactResult(injector).success(true) + override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResult(injector).success(true) + override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResult(injector).success(true) + override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResult(injector).success(true) + override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject() + override fun manufacturer(): ManufacturerType = ManufacturerType.AndroidAPS + override fun model(): PumpType = PumpType.GenericAAPS + override fun serialNumber(): String = "1" + override fun shortStatus(veryShort: Boolean): String = "" + override val isFakingTempsByExtendedBoluses: Boolean = false + override fun loadTDDs(): PumpEnactResult = PumpEnactResult(injector).success(true) + override fun canHandleDST(): Boolean = true + override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {} +} \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt similarity index 96% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index d450ef2687..834c549718 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants -import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType @@ -45,7 +45,7 @@ class DanaRPluginTest : TestBaseWithProfile() { `when`(resourceHelper.gs(R.string.pumplimit)).thenReturn("pump limit") `when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") - danaPump = info.nightscout.androidaps.dana.DanaPump(aapsLogger, sp, injector) + danaPump = DanaPump(aapsLogger, sp, injector) danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt similarity index 87% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt index 279076df49..42a1b1613d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt @@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase +import info.nightscout.androidaps.TestPumpPlugin import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin @@ -20,9 +21,11 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Before import org.mockito.Mock import org.mockito.Mockito.`when` +import org.mockito.Mockito.anyBoolean +import org.mockito.Mockito.doNothing import org.powermock.core.classloader.annotations.PrepareForTest -@PrepareForTest(DetailedBolusInfoStorage::class, ConstraintChecker::class) +@PrepareForTest(DetailedBolusInfoStorage::class, ConstraintChecker::class, DanaRKoreanPlugin::class, DanaRPlugin::class) open class DanaRTestBase : TestBase() { @Mock lateinit var sp: SP @@ -41,9 +44,16 @@ open class DanaRTestBase : TestBase() { @Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var nsUpload: NSUpload + lateinit var testPumpPlugin: TestPumpPlugin + @Before - fun prepareMock() { + fun setup() { + danaPump = DanaPump(aapsLogger, sp, injector) + testPumpPlugin = TestPumpPlugin(injector) `when`(activePluginProvider.activeTreatments).thenReturn(treatmentsInterface) + `when`(activePluginProvider.activePump).thenReturn(testPumpPlugin) + doNothing().`when`(danaRKoreanPlugin).setPluginEnabled(anyObject(), anyBoolean()) + doNothing().`when`(danaRPlugin).setPluginEnabled(anyObject(), anyBoolean()) } val injector = HasAndroidInjector { @@ -102,9 +112,4 @@ open class DanaRTestBase : TestBase() { array[6 + position] = value return array } - - @Before - fun setup() { - danaPump = info.nightscout.androidaps.dana.DanaPump(aapsLogger, sp, injector) - } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt similarity index 64% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt index a80a581bec..3c382e7a8e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt @@ -2,21 +2,15 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MessageHashTableR import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker -import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, ConfigBuilderPlugin::class) class MessageHashTableRTest : DanaRTestBase() { - @Test fun runTest() { Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) val messageHashTable = MessageHashTableR(injector) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt similarity index 96% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt index 1eec5b7473..d21a8f7939 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.R +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.danar.comm.MsgBolusProgress import info.nightscout.androidaps.db.Treatment import org.junit.Assert @@ -15,7 +15,6 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) class MsgBolusProgressTest : DanaRTestBase() { - @Test fun runTest() { `when`(resourceHelper.gs(ArgumentMatchers.eq(R.string.bolusdelivering), ArgumentMatchers.anyDouble())).thenReturn("Delivering %1\$.2fU") danaPump.bolusingTreatment = Treatment(HasAndroidInjector { AndroidInjector { } }) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt similarity index 95% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt index d1b353c259..d3bc63f092 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.R +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.danar.comm.MsgBolusStop import info.nightscout.androidaps.db.Treatment import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt similarity index 73% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt index a67bad6612..39798547c4 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt @@ -1,20 +1,15 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgError -import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(NSUpload::class) class MsgErrorTest : DanaRTestBase() { @Test fun runTest() { - PowerMockito.mockStatic(NSUpload::class.java) val packet = MsgError(injector) // test message decoding diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt index 1f3154a95f..400320eba5 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryAlarmTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryAlarm(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt similarity index 76% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt index cd95f1a530..4d61b03288 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt @@ -1,14 +1,9 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm -import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.danar.comm.MsgHistoryAll -import info.nightscout.androidaps.db.DatabaseHelper import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mockito.`when` -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt similarity index 92% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt index 05022714fd..67cf3ebcc2 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryBasalHourTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryBasalHour(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt index cbeabe16d1..b1748562ce 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryBolusTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryBolus(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt index 1433cb0470..1bf3cf77a6 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryCarboTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryCarbo(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt similarity index 92% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt index eae5d34e86..dd2274f669 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryDailyInsulinTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryDailyInsulin(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt index 86706531cf..320e34529d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryDoneTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryDone(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt index f2618a2bb7..1f0babb908 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryErrorTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryError(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt similarity index 92% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt index 3ec8c737dc..113c11dddd 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryGlucoseTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryGlucose(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt similarity index 92% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt index 0bfceb6477..321bd0f036 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryNewDoneTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryNewDone(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt index 229a21dde6..5144a672a1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryNewTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryNew(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt similarity index 91% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt index ccbb985ede..f4162adfb3 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryRefillTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistoryRefill(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt similarity index 92% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt index a45322f5b9..59f8d6a181 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt @@ -9,6 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistorySuspendTest : DanaRTestBase() { @Test fun runTest() { + @Suppress("UNUSED_VARIABLE") val packet = MsgHistorySuspend(injector) // nothing left to test } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt similarity index 66% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt index f86c346ba2..33ab2005dc 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt @@ -1,21 +1,15 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgInitConnStatusOption -import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mockito.`when` -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(VirtualPumpPlugin::class) class MsgInitConnStatusOptionTest : DanaRTestBase() { @Test fun runTest() { - `when`(activePluginProvider.activePump).thenReturn(PowerMockito.mock(VirtualPumpPlugin::class.java)) val packet = MsgInitConnStatusOption(injector) // test message decoding diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt similarity index 61% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt index be2a069952..9a850c7cd5 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt @@ -1,18 +1,12 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm -import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin -import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danar.comm.MsgInitConnStatusTime -import info.nightscout.androidaps.interfaces.CommandQueueProvider -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(DanaRKoreanPlugin::class, DanaRPlugin::class, ConfigBuilderPlugin::class, CommandQueueProvider::class) class MsgInitConnStatusTimeTest : DanaRTestBase() { @Test fun runTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt similarity index 96% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt index 600768548f..c7bed1eebb 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt @@ -16,7 +16,7 @@ class MsgSettingPumpTimeTest : DanaRTestBase() { danaPump.units = DanaPump.UNITS_MGDL // test message decoding val bytes = createArray(34, 7.toByte()) - val time = Date( + val time = GregorianCalendar( 100 + packet.intFromBuff(bytes, 5, 1), packet.intFromBuff(bytes, 4, 1) - 1, packet.intFromBuff(bytes, 3, 1), diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt similarity index 71% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt index 8827e59bcb..5bcbe1db9f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt @@ -1,20 +1,15 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(ConfigBuilderPlugin::class) class MsgStatusTempBasalTest : DanaRTestBase() { @Test fun runTest() { - `when`(activePluginProvider.activeTreatments).thenReturn(treatmentsInterface) val packet = MsgStatusTempBasal(injector) // test message decoding // test message decoding diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/RecordTypesTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt similarity index 98% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index 31b968ef12..f948cf7a10 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants -import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt similarity index 67% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt index 1632760ba7..2b8bcc6ae1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt @@ -2,22 +2,16 @@ package info.nightscout.androidaps.plugins.pump.danaRKorean.comm import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker -import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, ConfigBuilderPlugin::class) class MessageHashTableRKoreanTest : DanaRTestBase() { - @Test fun runTest() { Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) val messageHashTable = MessageHashTableRKorean(injector) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt similarity index 98% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index 980779da3b..2e0cee2135 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -4,10 +4,10 @@ import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants -import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt similarity index 73% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt index f531aa25ad..328b698dd8 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt @@ -4,20 +4,15 @@ import info.nightscout.androidaps.danaRv2.comm.MessageHashTableRv2 import info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2 import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker -import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, ConfigBuilderPlugin::class) -class MessageHashTable_rv2Test : DanaRTestBase() { +class MessageHashTableRv2Test : DanaRTestBase() { @Test fun runTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt similarity index 58% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt index f8aeb37b1d..9a85644f8a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt @@ -1,21 +1,15 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.dana.DanaPump -import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin -import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danaRv2.comm.MsgCheckValue_v2 -import info.nightscout.androidaps.danar.DanaRPlugin -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(DanaRKoreanPlugin::class, DanaRPlugin::class, DanaRv2Plugin::class, ConfigBuilderPlugin::class) -class MsgCheckValue_v2Test : DanaRTestBase() { +class MsgCheckValueRv2Test : DanaRTestBase() { @Test fun runTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt similarity index 95% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt index 1adaee10a3..89a1e4f0a1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt @@ -11,7 +11,7 @@ import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) @PrepareForTest(DetailedBolusInfoStorage::class) -class MsgHistoryEvents_v2Test : DanaRTestBase() { +class MsgHistoryEventsRv2Test : DanaRTestBase() { @Test @Throws(Exception::class) fun runTest() { val packet = MsgHistoryEvents_v2(injector, 0) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt similarity index 63% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt index 228a953b5c..53a52638a7 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm -import info.nightscout.androidaps.danars.comm.DanaRS_Packet_APS_Basal_Set_Temporary_Basal.Companion.PARAM30MIN +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 @@ -8,36 +8,36 @@ import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class MsgSetAPSTempBasalStart_v2Test : DanaRTestBase() { +class MsgSetAPSTempBasalStartRv2Test : DanaRTestBase() { @Test fun runTest() { // test low hard limit - var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, -1, true, false) + var packet = MsgSetAPSTempBasalStart_v2(injector, -1, true, false) Assert.assertEquals(0, packet.intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1)) // test high hard limit - packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 550, true, false) + packet = MsgSetAPSTempBasalStart_v2(injector, 550, true, false) Assert.assertEquals(500, packet.intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1)) // test setting 15 min - packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 50, true, false) + packet = MsgSetAPSTempBasalStart_v2(injector, 50, true, false) Assert.assertEquals(50, packet.intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1)) // test setting 30 min - packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 50, false, true) + packet = MsgSetAPSTempBasalStart_v2(injector, 50, false, true) Assert.assertEquals(50, packet.intFromBuff(packet.buffer, 0, 2)) - Assert.assertEquals(PARAM30MIN, packet.intFromBuff(packet.buffer, 2, 1)) + Assert.assertEquals(packet.PARAM30MIN, packet.intFromBuff(packet.buffer, 2, 1)) // over 200% set always 15 min - packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 250, false, true) + packet = MsgSetAPSTempBasalStart_v2(injector, 250, false, true) Assert.assertEquals(250, packet.intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1)) // test low hard limit - packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, -1, false, true) + packet = MsgSetAPSTempBasalStart_v2(injector, -1, false, true) Assert.assertEquals(0, packet.intFromBuff(packet.buffer, 0, 2)) - Assert.assertEquals(PARAM30MIN, packet.intFromBuff(packet.buffer, 2, 1)) + Assert.assertEquals(packet.PARAM30MIN, packet.intFromBuff(packet.buffer, 2, 1)) // test high hard limit - packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(injector, 550, false, true) + packet = MsgSetAPSTempBasalStart_v2(injector, 550, false, true) Assert.assertEquals(500, packet.intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, packet.intFromBuff(packet.buffer, 2, 1)) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt similarity index 93% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt index 8d21eab349..acc24a0fea 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt @@ -8,7 +8,7 @@ import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class MsgSetHistoryEntry_v2Test : DanaRTestBase() { +class MsgSetHistoryEntryRv2Test : DanaRTestBase() { @Test fun runTest() { val packet = MsgSetHistoryEntry_v2(injector, 1, System.currentTimeMillis(), 1, 0) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt similarity index 94% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt index 9f92821b35..ed0d4edb65 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt @@ -8,7 +8,7 @@ import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class MsgStatusAPS_v2Test : DanaRTestBase() { +class MsgStatusAPSRv2Test : DanaRTestBase() { @Test fun runTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtendedRv2Test.kt similarity index 92% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtendedRv2Test.kt index 33f96373eb..98b42c07cb 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtendedRv2Test.kt @@ -8,7 +8,7 @@ import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class MsgStatusBolusExtended_v2Test : DanaRTestBase() { +class MsgStatusBolusExtendedRv2Test : DanaRTestBase() { @Test fun runTest() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasalRv2Test.kt similarity index 93% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt rename to danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasalRv2Test.kt index b1b6da6960..31050bf109 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasalRv2Test.kt @@ -8,7 +8,7 @@ import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -class MsgStatusTempBasal_v2Test : DanaRTestBase() { +class MsgStatusTempBasalRv2Test : DanaRTestBase() { @Test fun runTest() { val packet = MsgStatusTempBasal_v2(injector)