diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt index cfabe73346..32fa6abf91 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt @@ -186,10 +186,10 @@ class SafetyPlugin @Inject constructor( override fun applyMaxIOBConstraints(maxIob: Constraint): Constraint { val apsMode = sp.getString(R.string.key_aps_mode, "open") - val maxIobPref: Double = if (openAPSSMBPlugin.isEnabled(PluginType.APS)) sp.getDouble(R.string.key_openapssmb_max_iob, 3.0) else sp.getDouble(R.string.key_openapsma_max_iob, 1.5) + val maxIobPref: Double = if (openAPSSMBPlugin.isEnabled()) sp.getDouble(R.string.key_openapssmb_max_iob, 3.0) else sp.getDouble(R.string.key_openapsma_max_iob, 1.5) maxIob.setIfSmaller(aapsLogger, maxIobPref, String.format(resourceHelper.gs(R.string.limitingiob), maxIobPref, resourceHelper.gs(R.string.maxvalueinpreferences)), this) - if (openAPSAMAPlugin.isEnabled(PluginType.APS)) maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobAMA(), String.format(resourceHelper.gs(R.string.limitingiob), hardLimits.maxIobAMA(), resourceHelper.gs(R.string.hardlimit)), this) - if (openAPSSMBPlugin.isEnabled(PluginType.APS)) maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobSMB(), String.format(resourceHelper.gs(R.string.limitingiob), hardLimits.maxIobSMB(), resourceHelper.gs(R.string.hardlimit)), this) + if (openAPSAMAPlugin.isEnabled()) maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobAMA(), String.format(resourceHelper.gs(R.string.limitingiob), hardLimits.maxIobAMA(), resourceHelper.gs(R.string.hardlimit)), this) + if (openAPSSMBPlugin.isEnabled()) maxIob.setIfSmaller(aapsLogger, hardLimits.maxIobSMB(), String.format(resourceHelper.gs(R.string.limitingiob), hardLimits.maxIobSMB(), resourceHelper.gs(R.string.hardlimit)), this) if (apsMode == "lgs") maxIob.setIfSmaller(aapsLogger, HardLimits.MAX_IOB_LGS, String.format(resourceHelper.gs(R.string.limitingiob), HardLimits.MAX_IOB_LGS, resourceHelper.gs(R.string.lowglucosesuspend)), this) return maxIob } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt index e6ce7fb821..63bf4a5724 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.plugins.general.maintenance import ch.qos.logback.classic.LoggerContext +import info.nightscout.androidaps.annotations.OpenForTesting import org.slf4j.LoggerFactory import javax.inject.Inject import javax.inject.Singleton @@ -8,6 +9,7 @@ import javax.inject.Singleton /** * This class provides several methods for log-handling (eg. sending logs as emails). */ +@OpenForTesting @Singleton class LoggerUtils @Inject constructor() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt index 7efeb7c466..43e68ec743 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSSettingsStatus.kt @@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.data import android.content.Context import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.R +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.database.entities.UserEntry import info.nightscout.androidaps.database.entities.UserEntry.Action import info.nightscout.androidaps.logging.AAPSLogger @@ -113,6 +114,7 @@ import javax.inject.Singleton } */ @Suppress("SpellCheckingInspection") +@OpenForTesting @Singleton class NSSettingsStatus @Inject constructor( private val aapsLogger: AAPSLogger, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt index 68b96bf0fb..7f88e33cd1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt @@ -47,7 +47,7 @@ class TherapyEventDataPoint @Inject constructor( } override fun getLabel(): String? = - if (data.note != null) data.note + if (data.note.isNullOrBlank().not()) data.note else translator.translate(data.type) override fun getDuration(): Long = data.duration diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index f78d83b4e2..4b9890d491 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -13,6 +13,7 @@ import androidx.work.workDataOf import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.OfflineEvent @@ -59,11 +60,13 @@ import javax.inject.Singleton import kotlin.math.max import kotlin.math.min +@OpenForTesting @Singleton class SmsCommunicatorPlugin @Inject constructor( injector: HasAndroidInjector, aapsLogger: AAPSLogger, resourceHelper: ResourceHelper, + private val smsManager: SmsManager, private val aapsSchedulers: AapsSchedulers, private val sp: SP, private val constraintChecker: ConstraintChecker, @@ -1088,7 +1091,6 @@ class SmsCommunicatorPlugin @Inject constructor( } fun sendSMS(sms: Sms): Boolean { - val smsManager = SmsManager.getDefault() sms.text = stripAccents(sms.text) try { aapsLogger.debug(LTag.SMS, "Sending SMS to " + sms.phoneNumber + ": " + sms.text) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/otp/OneTimePassword.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/otp/OneTimePassword.kt index 77470340a1..75235ca487 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/otp/OneTimePassword.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/otp/OneTimePassword.kt @@ -5,6 +5,7 @@ import com.eatthepath.otp.HmacOneTimePasswordGenerator import com.google.common.io.BaseEncoding import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP @@ -15,6 +16,7 @@ import javax.crypto.spec.SecretKeySpec import javax.inject.Inject import javax.inject.Singleton +@OpenForTesting @Singleton class OneTimePassword @Inject constructor( private val sp: SP, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt index 5929d53b77..94d907973a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt @@ -8,6 +8,7 @@ import androidx.work.workDataOf import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.data.PureProfile import info.nightscout.androidaps.events.EventProfileStoreChanged @@ -35,6 +36,7 @@ import javax.inject.Inject import javax.inject.Singleton import kotlin.collections.ArrayList +@OpenForTesting @Singleton class LocalProfilePlugin @Inject constructor( injector: HasAndroidInjector, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt index d2b167a43d..a6e0f24821 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt @@ -6,6 +6,7 @@ import androidx.work.WorkerParameters import androidx.work.workDataOf import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction @@ -21,6 +22,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import javax.inject.Inject import javax.inject.Singleton +@OpenForTesting @Singleton class GlimpPlugin @Inject constructor( injector: HasAndroidInjector, diff --git a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt index a8bdb9e92b..32775e9121 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt @@ -4,12 +4,17 @@ import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository +import info.nightscout.androidaps.database.entities.TherapyEvent +import info.nightscout.androidaps.database.entities.UserEntry.Action +import info.nightscout.androidaps.database.entities.UserEntry.Sources +import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag +import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification @@ -38,7 +43,8 @@ class LocalAlertUtils @Inject constructor( private val smsCommunicatorPlugin: SmsCommunicatorPlugin, private val config: Config, private val repository: AppRepository, - private val dateUtil: DateUtil + private val dateUtil: DateUtil, + private val uel: UserEntryLogger ) { private val disposable = CompositeDisposable() @@ -59,6 +65,7 @@ class LocalAlertUtils @Inject constructor( aapsLogger.debug(LTag.CORE, "Generating pump unreachable alarm. lastConnection: " + dateUtil.dateAndTimeString(lastConnection) + " isStatusOutdated: " + isStatusOutdated) sp.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold()) rxBus.send(EventNewNotification(Notification(Notification.PUMP_UNREACHABLE, resourceHelper.gs(R.string.pump_unreachable), Notification.URGENT).also { it.soundId = R.raw.alarm })) + uel.log(Action.CAREPORTAL, Sources.Aaps, resourceHelper.gs(R.string.pump_unreachable), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT)) if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(resourceHelper.gs(R.string.pump_unreachable))).subscribe() } @@ -117,6 +124,7 @@ class LocalAlertUtils @Inject constructor( n.soundId = R.raw.alarm sp.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold()) rxBus.send(EventNewNotification(n)) + uel.log(Action.CAREPORTAL, Sources.Aaps, resourceHelper.gs(R.string.missed_bg_readings), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT)) if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) { n.text?.let { disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(it)).subscribe() } } diff --git a/app/src/main/java/info/nightscout/androidaps/utils/Profiler.kt b/app/src/main/java/info/nightscout/androidaps/utils/Profiler.kt index b3ac2bbe94..b5a5ba1697 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/Profiler.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/Profiler.kt @@ -1,10 +1,12 @@ package info.nightscout.androidaps.utils +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import javax.inject.Inject import javax.inject.Singleton +@OpenForTesting @Singleton class Profiler @Inject constructor(val aapsLogger: AAPSLogger) { diff --git a/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.kt b/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.kt index bc7d5ff479..133a03187a 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/XdripCalibrations.kt @@ -4,6 +4,7 @@ import android.content.Context import android.content.Intent import android.os.Bundle import info.nightscout.androidaps.R +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.interfaces.GlucoseUnit import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger @@ -12,6 +13,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper import javax.inject.Inject import javax.inject.Singleton +@OpenForTesting @Singleton class XdripCalibrations @Inject constructor( private val aapsLogger: AAPSLogger, diff --git a/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt b/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt index b2bb3d99db..c37fedb8a4 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.utils.buildHelper import info.nightscout.androidaps.BuildConfig +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import java.io.File diff --git a/app/src/main/res/values-af-rZA/strings.xml b/app/src/main/res/values-af-rZA/strings.xml index 255884713c..45d6660066 100644 --- a/app/src/main/res/values-af-rZA/strings.xml +++ b/app/src/main/res/values-af-rZA/strings.xml @@ -147,7 +147,6 @@ Loop is gedeaktiveer Loop is geaktiveerd Lus geaktiveer - %1$.2f beperk tot %2$.2f Afstandbeheerde bevel word nie toegelaat nie Afstandbeheerde bolus nie beskikbaar nie. Probeer later weer. Om profiel te verander na %1$s %2$d%% antwoord met %3$s diff --git a/app/src/main/res/values-bg-rBG/objectives.xml b/app/src/main/res/values-bg-rBG/objectives.xml index b8d993fff4..14fdadc587 100644 --- a/app/src/main/res/values-bg-rBG/objectives.xml +++ b/app/src/main/res/values-bg-rBG/objectives.xml @@ -17,7 +17,6 @@ Прекарайте няколко дни по този начин, като поне една нощ нямате аларма за ниска КЗ Настройване на базалния инсулин и коефициенти ако е необходимо и активиране на auto-sens Една седмица успешно дневно използване с редовно въвеждане на въглехидрати - Активиране на допълнителни функции за дневно използване, включително и advanced meal assist (АМА) Добавяне на допълнителни функции за използване през деня, като SMB Разрешаване на автоматизация Трябва да прочетете wiki и увеличите maxIOB за да може SMB да работи добре! Добро начало е maxIOB = средния болус за хранене + 3 пъти най-големия базал от профила diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml index 9bdae85fbf..a453bfac59 100644 --- a/app/src/main/res/values-bg-rBG/strings.xml +++ b/app/src/main/res/values-bg-rBG/strings.xml @@ -188,7 +188,6 @@ APS е деактивиран APS е активиран APS е включен - %1$.2f ограничен до %2$.2f За свързване с помпа отговорете с код %1$s Връзката с помпата е неуспешна За да спрете помпата за %1$d минути отговорете с код %2$s diff --git a/app/src/main/res/values-cs-rCZ/objectives.xml b/app/src/main/res/values-cs-rCZ/objectives.xml index ab802e6388..cf5a84b627 100644 --- a/app/src/main/res/values-cs-rCZ/objectives.xml +++ b/app/src/main/res/values-cs-rCZ/objectives.xml @@ -17,7 +17,6 @@ Provozovat smyčku několik dní s alespoň jednou nocí bez alarmů na nízkou glykémii Upravit bazály a poměry, bude-li to potřeba, a povolit automatickou detekci citlivosti na inzulín Jeden týden úspěšného používání s běžným příjmem sacharidů - Povolení doplňkový funkcí pro každodenní použití, jako např. pokročilý jídelní asistent (AMA) Povolit další funkce pro běžné používání jako SMB Povolení automatizace Přečíst si dokumentaci a zvýšit maximální IOB, aby mohlo SMB fungovat. Pro začátek se dá použít velikost běžného bolusu + 3x maximální denní bazál diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml index 40c7230d2f..795c121236 100644 --- a/app/src/main/res/values-cs-rCZ/strings.xml +++ b/app/src/main/res/values-cs-rCZ/strings.xml @@ -189,8 +189,6 @@ Smyčka byla zakázána Smyčka byla povolena Smyčka je povolena - %1$.2f omezeno na %2$.2f - »%1$s« je mimo pevně nastavené limity Chcete-li připojit pumpu, odpovězte pomocí SMS s kódem %1$s Připojení k pumpě selhalo Chcete-li odpojit pumpu na %1$d minut, odpovězte pomocí SMS s kódem %2$s @@ -858,16 +856,6 @@ E-mailová adresa Nastavení soukromí Pokud chcete být upozorněni na selhání aplikace, můžete zadat volitelně e-mailovou adresu. Toto není automatizovaná služba. Vývojáři vás budou kontaktovat v nebezpečných situacích. - Dolní cíl profilu - Horní cíl profilu - Dolní hodnota dočasného cíle - Horní hodnota dočasného cíle - Hodnota dočasného cíle - Hodnota DIA profilu - Hodnota citlivosti profilu - Maximální hodnota bazálu profilu - Aktuální hodnota bazálu - Inzulino-sacharidový poměr profilu Úplná synchronizace Doplňování Synchronizace diff --git a/app/src/main/res/values-de-rDE/objectives.xml b/app/src/main/res/values-de-rDE/objectives.xml index 447501dd5d..bbd1442137 100644 --- a/app/src/main/res/values-de-rDE/objectives.xml +++ b/app/src/main/res/values-de-rDE/objectives.xml @@ -17,7 +17,6 @@ Bevor Du den Zielwert niedriger einstellst, musst Du einige Tage Erfahrung sammeln und mindestens eine Nacht ohne Hypoalarm schaffen Passe Basalraten und Faktoren bei Bedarf an und schalte anschließend Autosens ein. Loope eine Woche tagsüber mit regelmäßiger Kohlenhydrat-Eingabe - Aktiviere zusätzliche Funktionen für die Nutzung tagsüber wie z. B. den erweiterten Mahlzeitenassistenten (AMA) Aktiviere zusätzliche Funktionen für die Nutzung tagsüber wie z. B. SMB Automatisierung aktivieren Lies das Wiki und erhöhe maxIOB, damit der SMB gut funktioniert. Ein guter Anfang ist diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index 14ab35b660..e07caaf848 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -189,8 +189,6 @@ Loop wurde deaktiviert. Lopp wurde aktiviert. Loop ist aktiviert. - %1$.2f limitiert auf %2$.2f - »%1$s« ist außerhalb der fest programmierten Grenzen Um die Pumpe zu verbinden, antworte mit dem Code %1$s Verbindung zur Pumpe fehlgeschlagen Um die Verbindung zur Pumpe für %1$d Minuten zu trennen, antworte mit dem Code %2$s @@ -859,16 +857,6 @@ Unerwartetes Verhalten. E‐Mail‐Adresse Privatsphäre-Einstellungen Du kannst optional eine E-Mail-Adresse angeben, wenn Du bei Absturzberichten kontaktiert werden möchtest. Dies ist keine Automatik, Du wirst von den Entwicklern in gefährlichen Situationen kontaktiert. - Profil unteres Ziel - Profil oberes Ziel - Temp. Ziel unterer Wert - Temp. Ziel oberer Wert - Temp. Ziel Wert - Profil Insulinwirkdauer - Profil Sensitivitätswert - Profil max. Basalwert - Aktueller Basalwert - Profil KH-Faktor Vollständige Sync Füllen Synchronisierung diff --git a/app/src/main/res/values-el-rGR/objectives.xml b/app/src/main/res/values-el-rGR/objectives.xml index b1a3bf4d96..07d3f76fdc 100644 --- a/app/src/main/res/values-el-rGR/objectives.xml +++ b/app/src/main/res/values-el-rGR/objectives.xml @@ -17,7 +17,6 @@ Τρέξτε το για λίγες ημέρες, και τουλάχιστον μία νύχτα χωρίς χαμηλό συναγερμό BG, πριν χαμηλώσετε τα όρια Ρυθμίστε τον βασικό ρυθμό και τις αναλογίες αν χρειάζεται, και μετά ενεργοποιήστε το auto-sens 1 επιτυχής εβδομάδα ημερήσιου κυκλώματος με κανονική εισαγωγή υδατανθράκων - Ενεργοποιώντας επιπρόσθετα χαρακτηριστικά για χρήση κατά την ημέρα, όπως τον Προχωρημένο Βοηθό Γεύματος Ενεργοποιώντας επιπρόσθετα χαρακτηριστικά για χρήση κατά την ημέρα, όπως το SMB Πρέπει να διαβάσετε τον οδηγό wiki και να αυξήσετε το ανώτατο όριο του IOB για να μπορέσει να λειτουργήσει σωστά το SMB! Μια καλή αρχή είναι μέγιστο IOB= μέσο bolus γεύματος + 3 x το μέγιστο ημερήσιο βασικού ρυθμού BG διαθέσιμες στο NS diff --git a/app/src/main/res/values-el-rGR/strings.xml b/app/src/main/res/values-el-rGR/strings.xml index 3969bec2de..e19e0259ab 100644 --- a/app/src/main/res/values-el-rGR/strings.xml +++ b/app/src/main/res/values-el-rGR/strings.xml @@ -149,7 +149,6 @@ Το κύκλωμα απενεργοποιήθηκε Το κύκλωμα ενεργοποιήθηκε Κύκλωμα ενεργοποιημένο - Το %1$.2f περιορίζεται σε %2$.2f Δεν επιτρέπεται απομακρυσμένη εντολή Απομακρυσμένο bolus μη διαθέσιμο. Δοκιμάστε ξανά αργότερα. Για αλλαγή προφίλ σε %1$s %2$d%% στείλτε κωδικό %3$s diff --git a/app/src/main/res/values-es-rES/objectives.xml b/app/src/main/res/values-es-rES/objectives.xml index e2c5d553ee..59f41a60b5 100644 --- a/app/src/main/res/values-es-rES/objectives.xml +++ b/app/src/main/res/values-es-rES/objectives.xml @@ -17,7 +17,6 @@ Usar unos cuantos días, y al menos una noche sin alarmas de glucosa baja, antes de bajar valor de glucosa Ajustar las basales y ratios, si es necesario, y luego activar auto-sens Una semana con éxito en lazo cerrado durante el día con entrada regular de carbohidratos - Habilitar funciones adicionales para su uso durante el día, como el asistente de comida avanzado Habilitar funciones adicionales para uso durante el día como SMB Activar automatización ¡Debes leer el wiki y subir maxIOB para que SMB funcione bien! Para comenzar un buen valor sería maxIOB = bolo de comida medio + 3 x máximo basal diario diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 5c6597ab1c..54d825a9cb 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -188,7 +188,6 @@ Lazo se ha desactivado Lazo se ha activado Lazo activo - %1$.2f limitado a %2$.2f Para conectar la infusora responder con el código %1$s Error al conectar a la bomba Para desconectar la bomba durante %1$dminutos responde con el código %2$s diff --git a/app/src/main/res/values-fr-rFR/exam.xml b/app/src/main/res/values-fr-rFR/exam.xml index 822cb19c33..c34666ac39 100644 --- a/app/src/main/res/values-fr-rFR/exam.xml +++ b/app/src/main/res/values-fr-rFR/exam.xml @@ -132,6 +132,7 @@ Erreurs de saisie/injection d\'insuline Que devriez-vous faire si vous avez reçu moins d\'insuline que l\'historique de la pompe suggère par ex. à cause d\'une occlusion, d\'une mauvaise canule ou d\'un oubli de rebranchement de la pompe après une douche ? Supprimez les données d\'insuline de Nightscout Careportal pour le retirer de l\'historique de la pompe. + Comparer les valeurs dans l\'historique d\'AndroidAPS et de la pompe (si la pompe le permet). Faites un bolus du montant de votre insuline calculée « manquante » soit par seringue / stylo ou en utilisant un amorçage. Ne faites rien et laissez AndroidAPS corriger tout taux élevé de glycémie qui en résulte. Insuline Active (IA) diff --git a/app/src/main/res/values-fr-rFR/objectives.xml b/app/src/main/res/values-fr-rFR/objectives.xml index b58e7e6ef7..996e380bcc 100644 --- a/app/src/main/res/values-fr-rFR/objectives.xml +++ b/app/src/main/res/values-fr-rFR/objectives.xml @@ -17,7 +17,6 @@ Utilisez pendant plusieurs jours, et au moins une nuit sans alarme d’hypoglycémie, avant d\'abaisser les cibles glycémiques Ajustement des débits Basal et des ratios si nécessaire, puis activation de la fonction auto-sens 1 semaine de Boucle Fermée en journée en saisissant régulièrement les glucides - Activation de fonctionnalités supplémentaires en journée, comme l\'Aide au Repas Améliorée ARA (AMA) Activation de fonctionnalités supplémentaires pour l\'utilisation en journée, telles que la fonction SMB Activation de l\'automatisation Lisez le wiki et augmentez le maxIA pour que les SMBs fonctionnent correctement ! Un bon début est maxIA = moyenne des Bolus Repas + 3 x maximum débit Basal quotidien diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml index 995f8cf13b..e9e2d67f84 100644 --- a/app/src/main/res/values-fr-rFR/strings.xml +++ b/app/src/main/res/values-fr-rFR/strings.xml @@ -190,8 +190,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S La Boucle a été désactivée La Boucle a été activée La Boucle est activée - %1$.2f limité à %2$.2f - \"%1$s\" est en dehors des limites Pour connecter la pompe, renvoyez le code %1$s Echec de la connexion pompe Pour déconnecter la pompe pendant %1$d min, renvoyez le code %2$s @@ -859,16 +857,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Adresse e-mail Paramètres de confidentialité Vous pouvez fournir une adresse e-mail facultative si vous voulez être informé des plantages de l\'application. Ce n\'est pas un service automatisé. Vous serez contacté par les développeurs dans des situations dangereuses. - Cible basse du profil - Cible haute du profil - Valeur basse de cible temporaire - Valeur haute de cible temporaire - Valeur de cible temporaire - Valeur DAI du profil - Valeur de sensibilité du profil - Basale maximale du profil - Basale actuelle - Rapport glucides/insuline de profil Synchro. complète Amorcer Synchronisation @@ -892,4 +880,5 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Accepter les données MGC de NS Délai d\'attente pour finir la communication précédente avec la pompe Un autre bolus est en file d\'attente. Réessayez plus tard. + Calcul en cours diff --git a/app/src/main/res/values-it-rIT/exam.xml b/app/src/main/res/values-it-rIT/exam.xml index 7c8878f1c3..aeec52c1e6 100644 --- a/app/src/main/res/values-it-rIT/exam.xml +++ b/app/src/main/res/values-it-rIT/exam.xml @@ -132,7 +132,7 @@ Errori erogazione/inserimento insulina Cosa dovresti fare se hai ricevuto meno insulina di quanto lo storico del micro suggerisce? Ad esempio a causa di un\'occlusione, una cannula difettosa o l\'aver dimenticato di riattaccare il micro dopo una doccia?  Eliminare dal portale Nightscout i dati relativi all\'insulina per rimuoverli dallo storico del micro. - Compara valori in AndroidAPS e storico micro (se supportato). + Compara i valori in AndroidAPS con lo storico micro (se supportato). Erogare un bolo con parte della tua insulina calcolata \"mancante\" usando una siringa/penna o la funzione caricamento. Non fare nulla e permettere ad AndroidAPS di correggere eventuali glicemie alte. Insulina attiva (IOB) diff --git a/app/src/main/res/values-it-rIT/objectives.xml b/app/src/main/res/values-it-rIT/objectives.xml index 8882c00407..15e34cd03c 100644 --- a/app/src/main/res/values-it-rIT/objectives.xml +++ b/app/src/main/res/values-it-rIT/objectives.xml @@ -17,7 +17,6 @@ Esegui l\'applicazione per alcuni giorni e almeno una notte senza allarmi di glicemia bassa, prima di abbassare il target glicemico Adatta basali e rapporti se necessario, quindi attiva auto-sens 1 settimana di looping diurno con inserimento regolare dei carboidrati, eseguito con successo - Abilitazione funzioni aggiuntive per l\'uso diurno, ad esempio AMA (advanced meal assist - assistenza avanzata del pasto) Abilitazione funzioni aggiuntive per l\'uso diurno, come SMB Abilitazione automazione È necessario leggere il wiki e aumentare maxIOB affinché le azioni di SMB funzionino adeguatamente! Un buon inizio è maxIOB = media bolo posto + 3 x max basale giornaliera diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml index 8541779c8b..5bf1259491 100644 --- a/app/src/main/res/values-it-rIT/strings.xml +++ b/app/src/main/res/values-it-rIT/strings.xml @@ -189,8 +189,6 @@ Il loop è stato disabilitato Il loop è stato abilitato Il loop è abilitato - %1$.2f limitato a %2$.2f - »%1$s« è fuori dai limiti consentiti Per connettere il micro rispondi col codice %1$s Connessione al micro fallita Per disconnettere il micro per %1$d minuti rispondi col codice %2$s @@ -858,16 +856,6 @@ Indirizzo email Impostazioni privacy Puoi fornire un indirizzo e-mail opzionale se desideri essere avvisato in caso di arresti anomali dell\'app. Questo non è un servizio automatizzato. Sarai contattato dagli sviluppatori in situazioni pericolose. - Target basso (profilo) - Target alto (profilo) - Valore inferiore target temporaneo - Valore superiore target temporaneo - Valore target temporaneo - Valore DIA (profilo) - Valore sensibilità (profilo) - Valore max basale (profilo) - Valore basale corrente - Valore rapporto CHO (profilo) Sincronizzazione completa Caricamento Sincronizzazione diff --git a/app/src/main/res/values-iw-rIL/objectives.xml b/app/src/main/res/values-iw-rIL/objectives.xml index 8cdc440a4e..c6047474da 100644 --- a/app/src/main/res/values-iw-rIL/objectives.xml +++ b/app/src/main/res/values-iw-rIL/objectives.xml @@ -17,7 +17,6 @@ לפני הורדת ערך רמת הסוכר, הפעילו במשך מס\' ימים, עם לפחות לילה אחד ללא התרעת רמת סוכר נמוכה במידת הצורך, בצעו התאמת בזאלי ויחסים, ולאחר מכן הפעילו את Autosens שבוע של הפעלה מוצלחת של הלולאה במשך שעות היום, עם רישום ערכי פחמימות בקביעות - הפעלת פונקציות נוספות לשימוש במשך היום, לדוגמה AMA (סיוע ארוחות מתקדם) הפעלת פונקציות נוספות לשימוש במשך היום, כגון סופר מיקרו בולוסים (SMB) הפעלת אוטומציה חובה לקרוא את הויקי ולהעלות את ערך ה-maxIOB כדי להפעיל את ה- SMB כראוי. התחלה טובה תהיה maxIOB=בולוס ממוצע + 3 פעמים ערך הבזאלי היומי המקסימלי diff --git a/app/src/main/res/values-iw-rIL/strings.xml b/app/src/main/res/values-iw-rIL/strings.xml index 107b6d053e..2fb794cb9b 100644 --- a/app/src/main/res/values-iw-rIL/strings.xml +++ b/app/src/main/res/values-iw-rIL/strings.xml @@ -189,8 +189,6 @@ הלולאה הושבתה הלולאה הופעלה לולאה פעילה - %1$.2f מוגבלת ל- %2$.2f - »הערך %1$s« מחוץ לתחום הקשיח לחיבור המשאבה יש להשיב עם הקוד %1$s החיבור אל המשאבה נכשל לניתוק המשאבה למשך %1$d דקות השיבו עם הקוד %2$s @@ -858,16 +856,6 @@ כתובת דוא\"ל הגדרות פרטיות אם תרצו, תוכלו לספק כתובת דוא\"ל כדי לקבל דיווח על קריסות יישום. שירות זה אינו אוטומטי. המפתחים יצרו איתכם קשר במצבים מסוכנים. - ערך המטרה הנמוך של הפרופיל - ערך המטרה הגבוה של הפרופיל - ערך תחתון של המטרה הזמנית - ערך עליון של המטרה הזמנית - ערך המטרה הזמני - ערך DIA של הפרופיל - ערך הרגישות של הפרופיל - ערך מינון בזאלי מרבי של הפרופיל - מינון בזאלי נוכחי - יחס הפחמימות של הפרופיל סינכרון מלא תיחול סינכרון diff --git a/app/src/main/res/values-ko-rKR/objectives.xml b/app/src/main/res/values-ko-rKR/objectives.xml index 9bf19a6aee..9960748a92 100644 --- a/app/src/main/res/values-ko-rKR/objectives.xml +++ b/app/src/main/res/values-ko-rKR/objectives.xml @@ -17,7 +17,6 @@ 혈당을 낮추기 전에 몇일간 사용해보되 최소한 하루는 저혈당 알람이 발생하지 않도록 해봅니다 필요하면 Basal과 비율을 조절하고, auto-sens를 활성화합니다 섭취한 탄수화물양을 입력하고 1주일동안 낮시간대에 loop를 성공적으로 사용하여 봅니다 - AMA(Advanced Meal Assist)같은 낮시간대를 위한 추가적인 기능들을 실행하여 봅니다 낮시간대에 SMB(Super Micro Bolus)같은 추가기능을 활성화해 사용해봅니다 자동화 사용 SMB가 잘 작동하게 하기위해서 wiki를 반드시 읽은 다음 maxIOB 값을 올려보세요! maxIOB=평균 식사 Bolus + 3 x 최대하루 Basal이면 적당한 시작값입니다 diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index ef443cfa1f..66ed54c5d7 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -180,7 +180,6 @@ Loop가 중지되었습니다. Loop가 실행되었습니다. Loop가 실행중입니다. - %1$.2f, %2$.2f으로 제한됨 원격 명령이 허가되지 않았습니다 원격 주입이 불가능합니다. 나중에 다시 시도해주세요. 프로파일 %1$s %2$d%%로 변경하려면 %3$s 를 입력하고 답장하세요 diff --git a/app/src/main/res/values-lt-rLT/objectives.xml b/app/src/main/res/values-lt-rLT/objectives.xml index e1685d7195..442fbc1c45 100644 --- a/app/src/main/res/values-lt-rLT/objectives.xml +++ b/app/src/main/res/values-lt-rLT/objectives.xml @@ -17,7 +17,6 @@ Praleiskite keletą dienų ir bent vieną naktį be hipoglikemijos aliarmų Jei reikia, paderinkite valandines bazės vertes bei pagrindinius parametrus ir įgalinkite Autosens funkciją 1 savaitę praleiskite sėkmingai naudodami uždarąjį ciklą dienos metu ir įvesdami visus valgomus angliavandenius - Dienos metu aktyvuokite papildomas funkcijas, tokias kaip pažangioji maisto skaičiuoklė (AMA Advanced Meal Assist) Dienos metu aktyvuokite papildomas funkcijas, tokias kaip SMB (Super Mikro Bolusas) Automatizavimo įjungimas Norėdami, kad SMB veiktų gerai, turite perskaityti dokumentaciją ir padidinti max AIO! Pradžiai patartina skaičiuoti taip: maxAIO=(didžiausia valandinė bazė x 3) + vidutinis bolusas diff --git a/app/src/main/res/values-lt-rLT/strings.xml b/app/src/main/res/values-lt-rLT/strings.xml index cefb568db7..c79ed26966 100644 --- a/app/src/main/res/values-lt-rLT/strings.xml +++ b/app/src/main/res/values-lt-rLT/strings.xml @@ -186,7 +186,6 @@ Ciklas buvo išjungtas Ciklas buvo įjungtas Ciklas įjungtas - %1$.2f apribotas iki %2$.2f Pompos prijungimui atsakykite su kodu %1$s Nepavyko prisijungti prie pompos Norėdami atjungti pompą %1$d min., atsakykite kodu %2$s diff --git a/app/src/main/res/values-nl-rNL/objectives.xml b/app/src/main/res/values-nl-rNL/objectives.xml index 4ace018591..a54f6c68c6 100644 --- a/app/src/main/res/values-nl-rNL/objectives.xml +++ b/app/src/main/res/values-nl-rNL/objectives.xml @@ -17,7 +17,6 @@ Test enkele dagen als ook minstens 1 nacht zonder een laag BG alarm voordat je jouw streef BG verlaagt Pas het basaal en de ratios aan indien nodig, activeer hierna de auto-sens optie Gedurende 1 week succesvol overdag loopen met regelmatige invoer van koolhydraten - Activeren van extra functies overdag zoals AMA (geavanceerde maaltijdhulp, Advanced Meal Assist) Activeren van extra functies overdag zoals SMB (super micro bolus) Automatisering inschakelen Lees de wiki en verhoog maxIOB om SMB goed werkend te krijgen. Een goed begin is maxIOB=gemiddelde maaltijdbolus + 3 x max dagelijkse basaal diff --git a/app/src/main/res/values-nl-rNL/strings.xml b/app/src/main/res/values-nl-rNL/strings.xml index ae40757604..0ac1a956d4 100644 --- a/app/src/main/res/values-nl-rNL/strings.xml +++ b/app/src/main/res/values-nl-rNL/strings.xml @@ -189,8 +189,6 @@ Loop was uitgeschakeld Loop was ingeschakeld Loop is ingeschakeld - %1$.2f gelimiteerd tot %2$.2f - »Waarde %1$s is buiten de toegestane limieten Om verbinding te maken met pomp antwoord met code %1$s Verbinding maken met pomp is mislukt Om de pomp te ontkoppelen gedurende %1$d minuten antwoord met code %2$s @@ -858,15 +856,6 @@ E-mailadres Privacyinstellingen U kunt optioneel een e-mailadres opgeven als u op de hoogte wilt worden gebracht van applicatie crashes. Dit is geen geautomatiseerde service. De ontwikkelaars zullen contact met u opnemen bij gevaarlijke situaties. - Profiel laag doel - Profiel hoog doel - Tijdelijk streefdoel onder grens - Tijdelijk streefdoel boven grens - Tijdelijk streefdoel waarde - Profiel DIA waarde - Profiel gevoeligheidswaarde - Maximale basaal waarde van het profiel - Huidige basaal waarde Volledige synchronisatie Vullen Synchronisatie diff --git a/app/src/main/res/values-no-rNO/objectives.xml b/app/src/main/res/values-no-rNO/objectives.xml index f2830c8026..fcd81bbc3f 100644 --- a/app/src/main/res/values-no-rNO/objectives.xml +++ b/app/src/main/res/values-no-rNO/objectives.xml @@ -17,7 +17,6 @@ Kjør i noen dager og opplev minst en natt uten lavt BS alarmer før du begynner å redusere målverdi for BS Juster om nødvendig basal og forholdstall, og deretter aktiverer du autosens 1 uke vellykket looping på dagtid hvor alle måltider (KH) angis - Aktiver ekstra funksjoner for bruk på dagtid, slik som avansert måltidsassistent (AMA) Aktiver ekstra funksjoner for bruk på dagtid, slik som SMB (Super Micro Bolus) Aktiver Automatisering Du må lese wiki og øke din maxIOB for å få SMB til å fungere. Et godt utgangspunkt er maxIOB = gjennomsnittlig måltidsbolus + 3*max daglig basal diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-no-rNO/strings.xml index 859b484cba..f6abab1541 100644 --- a/app/src/main/res/values-no-rNO/strings.xml +++ b/app/src/main/res/values-no-rNO/strings.xml @@ -189,8 +189,6 @@ Loop har blitt deaktivert Loop har blitt aktivert Loop er aktivert - %1$.2f begrenset til %2$.2f - »%1$s« er utenfor lovlige grenseverdier For å koble til pumpen, svar med kode %1$s Tilkobling til pumpen mislyktes For å koble fra pumpen i %1$d minutter, svar med koden %2$s @@ -858,16 +856,6 @@ E-postadresse Personverninnstillinger Du kan oppgi valgfri e-postadresse hvis du ønsker å bli varslet om krasj. Dette er ikke en automatisert tjeneste. Du vil bli kontaktet av utviklere ved farlige hendelser. - Profil lavt blodsukkermål - Profil høyt blodsukkermål - Midlertidig mål bunnverdi - Midlertidig mål toppverdi - Midlertidig målverdi - Profil insulinvarighet (DIA) - Profil sensitivitetsverdi (IF) - Profil maksimal basal dose - Aktiv basal dose - Profil karbohydratfaktor (IK) Full synkronisering Prime Synkronisering diff --git a/app/src/main/res/values-pl-rPL/objectives.xml b/app/src/main/res/values-pl-rPL/objectives.xml index caf00353e4..4fbfd3cd4e 100644 --- a/app/src/main/res/values-pl-rPL/objectives.xml +++ b/app/src/main/res/values-pl-rPL/objectives.xml @@ -17,7 +17,6 @@ Używaj pętli przez kilka dni i przynajmniej jedną noc bez żadnego alarmu niskiego poziomu, przed obniżeniem docelowego poziomu cukru Dostosuj bazę i wartości parametrów jeśli jest to potrzebne, i wtedy uruchom funkcję autosens 1 tydzień sukcesu w działaniu pętli w ciągu dnia z regularnym wprowadzaniem spożywanych węglowodanów - Włączanie dodatkowych funkcji do użytku, jak AMA Włączanie dodatkowych funkcji do użytku, jak SMB (Super Mikro Bolusy) Włączanie automatyzacji Musisz przeczytać wiki i zwiększyć maxIOB, aby SMB działało dobrze! Dobrym początkiem jest maxIOB = średni bolus + 3 x maks. dzienna dawka bazowa diff --git a/app/src/main/res/values-pl-rPL/strings.xml b/app/src/main/res/values-pl-rPL/strings.xml index 679fa1b3a5..f52ab95fe6 100644 --- a/app/src/main/res/values-pl-rPL/strings.xml +++ b/app/src/main/res/values-pl-rPL/strings.xml @@ -188,7 +188,6 @@ Pętla (Loop) została wyłączona Pętla (Loop) została włączona Pętla (Loop) jest włączona - %1$.2f ograniczone do %2$.2f Aby podłączyć pompę odpowiedz kodem %1$s Połączenie z pompą nie powiodło się Aby odłączyć pompę na %1$d minut odpowiedz kodem %2$s diff --git a/app/src/main/res/values-pt-rBR/objectives.xml b/app/src/main/res/values-pt-rBR/objectives.xml index 64490f271b..a42d8779a3 100644 --- a/app/src/main/res/values-pt-rBR/objectives.xml +++ b/app/src/main/res/values-pt-rBR/objectives.xml @@ -17,7 +17,6 @@ Utilizar por alguns dias e pelo menos uma noite sem alarmes de Glic baixa, antes de baixar Glic Ajuste as basais e os rácios, se necessário, e, em seguida, active o auto-sens 1 semana de looping durante o dia com sucesso com entrada regular de hidratos de carbono - A ativar recursos adicionais para uso durante o dia, como assistente avançado de refeição Ativando recursos adicionais para uso durante o dia, como SMB A ativar a automação Deverá ler a wiki e aumentar a IOB máx para que os SMBs funcionem devidamente! Inicialmente poderá considerar maxIOB=média dos bólus + 3 x a basal máxima diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 48f5835d62..b7b9c8c480 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -175,7 +175,6 @@ Loop foi desativado Loop foi ativado Loop ativado - %1$.2f limitado a %2$.2f Bomba desconectada Bomba reconectada O comando remoto não é permitido diff --git a/app/src/main/res/values-pt-rPT/objectives.xml b/app/src/main/res/values-pt-rPT/objectives.xml index 6c2c3e1e45..fc379dd686 100644 --- a/app/src/main/res/values-pt-rPT/objectives.xml +++ b/app/src/main/res/values-pt-rPT/objectives.xml @@ -17,7 +17,6 @@ Utilizar por alguns dias e pelo menos uma noite sem alarmes de GLIC baixa, antes de baixar GLIC Ajuste as basais e os rácios, se necessário, e, em seguida, active o auto-sens 1 semana de looping durante o dia com sucesso com entrada regular de hidratos de carbono - A activar recursos adicionais para uso durante o dia, como assistente avançado de refeição Activando recursos adicionais para uso durante o dia, como SMB A ativar a automatização Deverá ler a wiki e aumentar a IA máx para que os SMBs funcionem devidamente! Inicialmente poderá considerar maxIA=média dos bólus + 3 x a basal máxima diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 22a0f8e63f..05032c9a19 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -189,8 +189,6 @@ Loop foi desactivado Loop foi activado Loop activado - %1$.2f limitado a %2$.2f - »%1$s« está fora dos limites máximos Para ligar a bomba responda com o código %1$s Ligação à bomba falhou Para remover a bomba por %1$d minutos responda com o código %2$s @@ -857,14 +855,4 @@ Endereço de email Definições de privacidade Opcionalmente pode fornecer um endereço de e-mail se quiser ser notificado sobre os erros da app. Este não é um serviço automatizado. Será contactado por desenvolvedores em situações perigosas. - Perfil Alvo Baixo - Perfil Alvo Alto - Valor Alvo Temporário Inferior - Valor Alvo Temporário Superior - Valor Alvo Temporário - Valor Perfil DIA - Valor Perfil Sensibilidade - Valor Perfil Basal Máxima - Valor Actual Basal - Valor Perfil Rácio Hidratos diff --git a/app/src/main/res/values-ro-rRO/objectives.xml b/app/src/main/res/values-ro-rRO/objectives.xml index e42622a963..7d68ac47e5 100644 --- a/app/src/main/res/values-ro-rRO/objectives.xml +++ b/app/src/main/res/values-ro-rRO/objectives.xml @@ -17,7 +17,6 @@ Se rulează pentru câteva zile și cel puțin o noapte fără a avea alarme de glicemie mică înainte de scăderea țintei Ajustarea bazalelor și a factorilor dacă este necesar și apoi activarea auto-sens O săptămână de buclă închisă încheiată cu succes în condițiile introducerii regulate a carbohidraților - Activarea unor facilități adiționale pentru funcționarea în timpul zilei, cum ar fi advanced meal assist Se activează opțiuni pentru uzul în timpul zilei, cum ar fi SMB Activarea automatizării Trebuie sa citiți wiki și să măriți maxIOB pentru a obține SMB corect! Un start bun este maxIOB=media bolusurilor + 3x maxima bazalei din zi diff --git a/app/src/main/res/values-ro-rRO/strings.xml b/app/src/main/res/values-ro-rRO/strings.xml index 793a9d641d..48f9e922ee 100644 --- a/app/src/main/res/values-ro-rRO/strings.xml +++ b/app/src/main/res/values-ro-rRO/strings.xml @@ -188,7 +188,6 @@ Bucla a fost dezactivată Bucla a fost activată Bucla este activată - %1$.2f este limitată la %2$.2f Pentru a conecta pompa raspundeti cu codul %1$s Conectarea cu pompa a esuat Pentru a deconecta pompa timp de %1$d minute, răspundeți cu: %2$s diff --git a/app/src/main/res/values-ru-rRU/objectives.xml b/app/src/main/res/values-ru-rRU/objectives.xml index 53d36c9095..65f4dd716f 100644 --- a/app/src/main/res/values-ru-rRU/objectives.xml +++ b/app/src/main/res/values-ru-rRU/objectives.xml @@ -17,7 +17,6 @@ Работа несколько дней и по кр мере одну ночь без срабатывания оповещений о низкой ГК Настраиваем базал и коэффициенты с последующей активацией auto-sens 1 неделя успешной дневной работы с регулярным введением углеводов - Активация таких доп функций для дневного времени как расширенный калькулятор болюса advanced meal assist Активация таких доп функций для дневного времени как супер микро болюс SMB Включение автоматизации Прочтите wiki и увеличьте maxIOB чтобы супер микро болюс SMB заработал как положено! Хорошее начало – maxIOB = средний болюс на еду + троекратный максимальный суточный базал diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml index e78241c304..6804c6672a 100644 --- a/app/src/main/res/values-ru-rRU/strings.xml +++ b/app/src/main/res/values-ru-rRU/strings.xml @@ -189,8 +189,6 @@ зцикл был деактивирован зцикл был активирован зцикл работает - %1$.2f ограничено до %2$.2f - »%1$s«за пределами жестких ограничений Чтобы подсоединить помпу ответьте кодом %1$s Ошибка подключения к помпе Для разъединения с помпой на %1$d мин ответьте кодом %2$s @@ -860,16 +858,6 @@ Context | Edit Context Адрес электронной почты Настройки конфиденцальности Вы можете указать дополнительно адрес электронной почты, если хотите получать уведомления о сбоях приложения; что является не автоматизированной рассылкой, а способом связи с разработчиками в опасных ситуациях. - Нижнее целевое значение профиля - Верхнее целевое значение профиля - Нижнее значение временного целевого уровня - Верхнее значение временного целевого уровня - Временное целевое значение - Значение длительности действия инсулина DIA в профиле - Значение чувствительности в профиле - Максимальное значение базала в профиле - Текущее значение базала - Коэффициент углеводов в профиле Полная синхронизация Заполнение инфузионной системы Синхронизация diff --git a/app/src/main/res/values-sk-rSK/objectives.xml b/app/src/main/res/values-sk-rSK/objectives.xml index a89964c316..8960f81abd 100644 --- a/app/src/main/res/values-sk-rSK/objectives.xml +++ b/app/src/main/res/values-sk-rSK/objectives.xml @@ -17,7 +17,6 @@ Používať uzavretý okruh niekoľko dní s aspoň jednou nocou bez alarmov na nízku glykémiu Upraviť bazály a pomery, ak je to potrebné, a povoliť automatickú detekciu citlivosti na inzulín Jeden týždeň úspešného používania s bežným príjmom sacharidov - Povolenie doplnkových funkcií pre každodenné použitie, ako napr. pokročilý asistent jedál (AMA) Povoliť ďalšie funkcie pre bežné používanie ako SMB Povolenie automatiky Prečítať si dokumentáciu a zvýšiť maximálne IOB, aby mohlo správne fungovať SMB! Pre začiatok sa dá použiť veľkosť bežného bolusu + 3x maximálny denný bazál diff --git a/app/src/main/res/values-sk-rSK/strings.xml b/app/src/main/res/values-sk-rSK/strings.xml index 91823c5f4b..a935d2f922 100644 --- a/app/src/main/res/values-sk-rSK/strings.xml +++ b/app/src/main/res/values-sk-rSK/strings.xml @@ -189,8 +189,6 @@ Uzavretý okruh bol deaktivovaný Uzavretý okruh bol aktivovaný Uzavretý okruh je aktivovaný - %1$.2f obmedzené na %2$.2f - »%1$s« je mimo pevne nastavené limity Ak chcete pripojiť pumpu, odpovedzte pomocou SMS s kódom %1$s Pripojenie k pumpe zlyhalo Ak chcete odpojiť pumpu na %1$d minút, odpovedzte pomocou SMS s kódom %2$s @@ -858,16 +856,6 @@ Emailová adresa Nastavenia súkromia Pokiaľ chcete byť upozornení na zlyhanie aplikácie, môžete zadať voliteľne e-mailovú adresu. Toto nie je automatizovaná služba. Vývojári vás budú kontaktovať v nebezpečných situáciách. - Dolný cieľ profilu - Horný cieľ profilu - Dolná hodnota dočasného cieľa - Horná hodnota dočasného cieľa - Hodnota dočasného cieľa - Profilová hodnota DIA - Profilová hodnota citlivosti - Profilová maximálna hodnota bazálu - Aktuálna hodnota bazálu - Profilový inzulino-sacharidový pomer Úplná synchronizácia Plnenie Synchronizácia diff --git a/app/src/main/res/values-sv-rSE/objectives.xml b/app/src/main/res/values-sv-rSE/objectives.xml index 669c70e38e..a6b3f3e1b4 100644 --- a/app/src/main/res/values-sv-rSE/objectives.xml +++ b/app/src/main/res/values-sv-rSE/objectives.xml @@ -17,7 +17,6 @@ Kör några dagar och åtminstone en natt utan larm för lågt BG innan du sänker målvärdet för BG Justera basaler och kvoter om det behövs. Aktivera sedan autosens 1 veckas lyckad looping dagtid, där alla måltider lagts in - Aktiverar extra funktioner som kan användas dagtid, såsom avancerad måltidsassistans, AMA Aktiverar ytterligare funktioner för användning dagtid, t ex SMB Aktivera automatisering Du måste läsa på wikin och öka max IOB för att få SMB att fungera bra. En bra start är att sätta max IOB till din genomsnittliga måltidsbolus plus 3 gånger den högsta basalen du har under ett dygn diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index 94245dba76..3a808d3a30 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -190,8 +190,6 @@ Eversense-appen. Loop inaktiverad. Loop aktiverad Loop är aktiverad - %1$.2f begränsat till %2$.2f - »%1$s« är utanför de hårda gränserna För att ansluta pumpen, svara med kod %1$s Anslutning till pump misslyckades För att koppla från pumpen i %1$d minuter, svara med kod %2$s @@ -859,16 +857,6 @@ Eversense-appen. E-postadress Sekretessinställningar Du kan ange valfri e-postadress om du vill få meddelanden om appkrascher. Det här är ingen automatiserad tjänst. Du kommer att kontaktas av utvecklare i farliga situationer. - Nedre målvärde för profilen - Övre målvärde för profilen - Nedre värde för temp mål - Övre värde för temp mål - Temp målvärde - Profilens DIA - Profilens insulinkänslighetsvärde - Maximal basaldos för profil - Nuvarande basaldos - Profilens KH-kvot Full synkronisering Förfyllning Synkronisering diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index da43d1f516..2099fdcdc0 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -145,7 +145,6 @@ Döngü devre dışı bırakıldı Döngü etkinleştirildi Döngü etkin - %1$.2f dan %2$.2f olarak sınırlı Uzaktan komuta izin verilmez %1$d dakika için Döngü\'yü askıya almak için %2$s kodunu yanıtla Geçici bazal %1$.2fÜ/s %2$d dakika için başarıyla başlatıldı diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 910992c926..b82944f112 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -146,7 +146,6 @@ 闭环已经被禁用 闭环已经被启用 闭环被启用 - %1$.2f 超过 %2$.2f的限制 远程命令没有被允许 远程大剂量不可用。请稍后再试。 要切换配置文件到 %1$s %2$d%% 请回复代码 %3$s diff --git a/app/src/main/res/xml/pref_overview.xml b/app/src/main/res/xml/pref_overview.xml index a8192da144..ad2367c9ee 100644 --- a/app/src/main/res/xml/pref_overview.xml +++ b/app/src/main/res/xml/pref_overview.xml @@ -180,7 +180,7 @@ android:inputType="numberDecimal" android:key="@string/key_activity_target" android:title="@string/activity_target" - validate:floatmaxNumber="220.0" + validate:floatmaxNumber="180.0" validate:floatminNumber="6.0" validate:testType="floatNumericRange" /> @@ -198,7 +198,7 @@ android:inputType="numberDecimal" android:key="@string/key_hypo_target" android:title="@string/hypo_target" - validate:floatmaxNumber="220.0" + validate:floatmaxNumber="180.0" validate:floatminNumber="6.0" validate:testType="floatNumericRange" /> diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index bd1f676d4e..ccbb41c2ba 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -7,7 +7,11 @@ import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.database.embedments.InsulinConfiguration import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch import info.nightscout.androidaps.extensions.pureProfileFromJson -import info.nightscout.androidaps.interfaces.* +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.Config +import info.nightscout.androidaps.interfaces.IobCobCalculator +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ProfileStore import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy @@ -15,10 +19,8 @@ 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: ActivePlugin 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 8bd8c49739..61f30ea92e 100644 --- a/app/src/test/java/info/nightscout/androidaps/data/QuickWizardTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/data/QuickWizardTest.kt @@ -15,7 +15,6 @@ import org.junit.Before import org.junit.Test import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.api.mockito.PowerMockito class QuickWizardTest : TestBase() { @@ -44,7 +43,7 @@ class QuickWizardTest : TestBase() { @Before fun mock() { - PowerMockito.`when`(profileFunction.secondsFromMidnight()).thenReturn(0) + `when`(profileFunction.secondsFromMidnight()).thenReturn(0) `when`(sp.getString(R.string.key_quickwizard, "[]")).thenReturn("[]") quickWizard = QuickWizard(sp, injector) } 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 874175a2be..19f7b55364 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.interfaces -import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R @@ -36,22 +35,13 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.util.* /** * Created by mike on 18.03.2018. */ -@RunWith(PowerMockRunner::class) -@PrepareForTest( - ConstraintChecker::class, SP::class, Context::class, - OpenAPSAMAPlugin::class, OpenAPSSMBPlugin::class, - VirtualPumpPlugin::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class, GlimpPlugin::class, Profiler::class, - UserEntryLogger::class, PrefFileListProvider::class, AppRepository::class, InsightDatabaseDao::class) class ConstraintsCheckerTest : TestBaseWithProfile() { @Mock lateinit var activePlugin: ActivePlugin @@ -98,7 +88,6 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { fun prepare() { `when`(resourceHelper.gs(R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.") `when`(resourceHelper.gs(R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences") - `when`(resourceHelper.gs(R.string.objectivenotstarted)).thenReturn("Objective %d not started") `when`(resourceHelper.gs(R.string.novalidbasalrate)).thenReturn("No valid basal rate read from pump") `when`(resourceHelper.gs(R.string.autosensdisabledinpreferences)).thenReturn("Autosens disabled in preferences") `when`(resourceHelper.gs(R.string.smbdisabledinpreferences)).thenReturn("SMB disabled in preferences") @@ -125,6 +114,10 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { `when`(resourceHelper.gs(R.string.limitingbasalratio, 0.8, "pump limit")).thenReturn("") `when`(resourceHelper.gs(R.string.limitingpercentrate, 200, "pump limit")).thenReturn("") `when`(resourceHelper.gs(R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 9)).thenReturn("Objective 9 not started") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 8)).thenReturn("Objective 8 not started") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 6)).thenReturn("Objective 6 not started") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 1)).thenReturn("Objective 1 not started") // RS constructor `when`(sp.getString(R.string.key_danars_address, "")).thenReturn("") 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 046472a25e..270414aae3 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 @@ -4,7 +4,6 @@ import android.app.NotificationManager import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.database.AppRepository @@ -17,19 +16,15 @@ import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.receivers.ReceiverStatusStore import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, ReceiverStatusStore::class, RunningConfiguration::class, UserEntryLogger::class, DateUtil::class) class LoopPluginTest : TestBase() { @Mock lateinit var sp: SP 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 fa4d5196a2..9b6a5fde7d 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 @@ -11,13 +11,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(UserEntryLogger::class) class ConfigBuilderPluginTest : TestBase() { @Mock lateinit var sp: SP diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt index da4192d33d..829ca48d4e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/dstHelper/DstHelperPluginTest.kt @@ -11,14 +11,11 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner import java.text.DateFormat import java.text.SimpleDateFormat import java.util.* -@RunWith(PowerMockRunner::class) class DstHelperPluginTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper @@ -42,31 +39,31 @@ class DstHelperPluginTest : TestBase() { var cal = Calendar.getInstance(tz, Locale.ITALIAN) val df: DateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ITALIAN) var dateBeforeDST = df.parse("2018-03-25 01:55") - cal.time = dateBeforeDST + cal.time = dateBeforeDST!! Assert.assertEquals(false, plugin.wasDST(cal)) Assert.assertEquals(true, plugin.willBeDST(cal)) TimeZone.setDefault(tz) cal = Calendar.getInstance(tz, Locale.ITALIAN) dateBeforeDST = df.parse("2018-03-25 03:05") - cal.time = dateBeforeDST + cal.time = dateBeforeDST!! Assert.assertEquals(true, plugin.wasDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal)) TimeZone.setDefault(tz) cal = Calendar.getInstance(tz, Locale.ITALIAN) dateBeforeDST = df.parse("2018-03-25 02:05") //Cannot happen!!! - cal.time = dateBeforeDST + cal.time = dateBeforeDST!! Assert.assertEquals(true, plugin.wasDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal)) TimeZone.setDefault(tz) cal = Calendar.getInstance(tz, Locale.ITALIAN) dateBeforeDST = df.parse("2018-03-25 05:55") //Cannot happen!!! - cal.time = dateBeforeDST + cal.time = dateBeforeDST!! Assert.assertEquals(true, plugin.wasDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal)) TimeZone.setDefault(tz) cal = Calendar.getInstance(tz, Locale.ITALIAN) dateBeforeDST = df.parse("2018-03-25 06:05") //Cannot happen!!! - cal.time = dateBeforeDST + cal.time = dateBeforeDST!! Assert.assertEquals(false, plugin.wasDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal)) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt index c08f4c9033..795a677695 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPluginTest.kt @@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.constraints.objectives import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.ActivePlugin @@ -10,19 +9,15 @@ import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(UserEntryLogger::class, DateUtil::class) class ObjectivesPluginTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper @@ -46,7 +41,10 @@ class ObjectivesPluginTest : TestBase() { @Before fun prepareMock() { objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, resourceHelper, activePlugin, sp, ConfigImpl(), dateUtil, uel) objectivesPlugin.onStart() - `when`(resourceHelper.gs(R.string.objectivenotstarted)).thenReturn("Objective %1\$d not started") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 9)).thenReturn("Objective 9 not started") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 8)).thenReturn("Objective 8 not started") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 6)).thenReturn("Objective 6 not started") + `when`(resourceHelper.gs(R.string.objectivenotstarted, 1)).thenReturn("Objective 1 not started") } @Test fun notStartedObjectivesShouldLimitLoopInvocation() { @@ -78,7 +76,7 @@ class ObjectivesPluginTest : TestBase() { objectivesPlugin.objectives[ObjectivesPlugin.SMB_OBJECTIVE].startedOn = 0 var c = Constraint(true) c = objectivesPlugin.isSMBModeEnabled(c) - Assert.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 10 not started")) + Assert.assertEquals(true, c.getReasons(aapsLogger).contains("Objective 9 not started")) Assert.assertEquals(false, c.value()) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt index 209e7d2da6..bc54c57e09 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt @@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.constraints.safety import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile @@ -18,18 +17,14 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.source.GlimpPlugin import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, BuildHelper::class, VirtualPumpPlugin::class, GlimpPlugin::class) class SafetyPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP @@ -231,17 +226,18 @@ class SafetyPluginTest : TestBaseWithProfile() { } @Test fun iobShouldBeLimited() { + `when`(openAPSSMBPlugin.isEnabled()).thenReturn(true) + `when`(openAPSAMAPlugin.isEnabled()).thenReturn(false) `when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("closed") `when`(sp.getDouble(R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5) + `when`(sp.getDouble(R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0) `when`(sp.getString(R.string.key_age, "")).thenReturn("teenage") // Apply all limits var d = Constraint(Constants.REALLYHIGHIOB) d = safetyPlugin.applyMaxIOBConstraints(d) - Assert.assertEquals(1.5, d.value(), 0.01) - Assert.assertEquals(""" - Safety: Limiting IOB to 1.5 U because of max value in preferences - """.trimIndent(), d.getReasons(aapsLogger)) - Assert.assertEquals("Safety: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) + Assert.assertEquals(3.0, d.value(), 0.01) + Assert.assertEquals("Safety: Limiting IOB to 3.0 U because of max value in preferences\nSafety: Limiting IOB to 12.0 U because of hard limit", d.getReasons(aapsLogger)) + Assert.assertEquals("Safety: Limiting IOB to 3.0 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/storage/StorageConstraintPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/storage/StorageConstraintPluginTest.kt index 6be468634c..780fc29a0a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/storage/StorageConstraintPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/storage/StorageConstraintPluginTest.kt @@ -10,14 +10,11 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` import org.mockito.Mockito.anyInt import org.mockito.Mockito.anyLong -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class StorageConstraintPluginTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper 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 0a8dd8db50..14ab61d104 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 @@ -2,24 +2,19 @@ package info.nightscout.androidaps.plugins.general.maintenance import android.content.Context import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.io.File -@RunWith(PowerMockRunner::class) -@PrepareForTest(NSSettingsStatus::class, BuildHelper::class, LoggerUtils::class, PrefFileListProvider::class) class MaintenancePluginTest : TestBase() { @Mock lateinit var injector: HasAndroidInjector diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegateTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegateTest.kt index 74751fe5f5..c4ae16c2d7 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegateTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/nsclient/NsClientReceiverDelegateTest.kt @@ -12,19 +12,13 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyLong import org.mockito.ArgumentMatchers.anyString import org.mockito.Mock 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(SP::class, Context::class) class NsClientReceiverDelegateTest : TestBase() { @Mock lateinit var context: Context @@ -47,7 +41,6 @@ class NsClientReceiverDelegateTest : TestBase() { } @Test fun testCalculateStatusChargingState() { - PowerMockito.mockStatic(SP::class.java) `when`(sp.getBoolean(anyInt(), anyBoolean())).thenReturn(false) var ev = EventChargingState(true, 0) Assert.assertTrue(sut!!.calculateStatus(ev)) @@ -61,7 +54,6 @@ class NsClientReceiverDelegateTest : TestBase() { } @Test fun testCalculateStatusNetworkState() { - PowerMockito.mockStatic(SP::class.java) // wifiOnly = false // allowRoaming = false as well `when`(sp.getBoolean(anyInt(), anyBoolean())).thenReturn(false) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/AuthRequestTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/AuthRequestTest.kt index cf4e9d1b87..228c4aa802 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/AuthRequestTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/AuthRequestTest.kt @@ -13,17 +13,12 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` +import org.mockito.Mockito.doAnswer import org.mockito.invocation.InvocationOnMock import org.mockito.stubbing.Answer -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(SmsCommunicatorPlugin::class, DateUtil::class, OneTimePassword::class) class AuthRequestTest : TestBase() { @Mock lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin @@ -48,7 +43,7 @@ class AuthRequestTest : TestBase() { @Before fun prepareTests() { `when`(resourceHelper.gs(R.string.sms_wrongcode)).thenReturn("Wrong code. Command cancelled.") - PowerMockito.doAnswer(Answer { invocation: InvocationOnMock -> + doAnswer(Answer { invocation: InvocationOnMock -> sentSms = invocation.getArgument(0) null } as Answer<*>).`when`(smsCommunicatorPlugin).sendSMS(anyObject()) @@ -87,11 +82,10 @@ class AuthRequestTest : TestBase() { // test timed out message val now: Long = 10000 - PowerMockito.mockStatic(DateUtil::class.java) - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) authRequest = AuthRequest(injector, requester, "Request text", "ABC", action) actionCalled = false - PowerMockito.`when`(dateUtil.now()).thenReturn(now + T.mins(Constants.SMS_CONFIRM_TIMEOUT).msecs() + 1) + `when`(dateUtil.now()).thenReturn(now + T.mins(Constants.SMS_CONFIRM_TIMEOUT).msecs() + 1) authRequest.action("ABC") Assert.assertFalse(actionCalled) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsActionTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsActionTest.kt index ba47efe6c9..e0563c27c9 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsActionTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsActionTest.kt @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.general.smsCommunicator import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class SmsActionTest { var result = "" diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt index a2c6d32a08..a56824dd4c 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt @@ -1,5 +1,3 @@ -@file:Suppress("SpellCheckingInspection") - package info.nightscout.androidaps.plugins.general.smsCommunicator import android.telephony.SmsManager @@ -29,9 +27,7 @@ import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.queue.Callback -import info.nightscout.androidaps.queue.CommandQueue import info.nightscout.androidaps.utils.DateUtil -import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.XdripCalibrations import info.nightscout.androidaps.utils.buildHelper.ConfigImpl @@ -40,24 +36,15 @@ import io.reactivex.Single import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito import org.mockito.Mockito.`when` import org.mockito.Mockito.anyLong import org.mockito.invocation.InvocationOnMock -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.util.* -@RunWith(PowerMockRunner::class) -@PrepareForTest( - ConstraintChecker::class, FabricPrivacy::class, VirtualPumpPlugin::class, XdripCalibrations::class, - SmsManager::class, CommandQueue::class, LocalProfilePlugin::class, DateUtil::class, - OneTimePassword::class, UserEntryLogger::class, LoopPlugin::class, - AppRepository::class, DateUtil::class, AutosensDataStore::class) +@Suppress("SpellCheckingInspection") class SmsCommunicatorPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP @@ -73,6 +60,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { @Mock lateinit var repository: AppRepository @Mock lateinit var dateUtilMocked: DateUtil @Mock lateinit var autosensDataStore: AutosensDataStore + @Mock lateinit var smsManager: SmsManager var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { @@ -102,9 +90,6 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { `when`(iobCobCalculator.ads).thenReturn(autosensDataStore) `when`(autosensDataStore.lastBg()).thenReturn(reading) - PowerMockito.mockStatic(SmsManager::class.java) - val smsManager = PowerMockito.mock(SmsManager::class.java) - `when`(SmsManager.getDefault()).thenReturn(smsManager) `when`(sp.getString(R.string.key_smscommunicator_allowednumbers, "")).thenReturn("1234;5678") `when`( @@ -113,7 +98,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { })) val glucoseStatusProvider = GlucoseStatusProvider(aapsLogger = aapsLogger, iobCobCalculator = iobCobCalculator, dateUtil = dateUtilMocked) - smsCommunicatorPlugin = SmsCommunicatorPlugin(injector, aapsLogger, resourceHelper, aapsSchedulers, sp, constraintChecker, rxBus, profileFunction, fabricPrivacy, activePlugin, commandQueue, loopPlugin, iobCobCalculator, xdripCalibrations, otp, ConfigImpl(), dateUtilMocked, uel, glucoseStatusProvider, repository) + smsCommunicatorPlugin = SmsCommunicatorPlugin(injector, aapsLogger, resourceHelper, smsManager, aapsSchedulers, sp, constraintChecker, rxBus, profileFunction, fabricPrivacy, activePlugin, commandQueue, loopPlugin, iobCobCalculator, xdripCalibrations, otp, ConfigImpl(), dateUtilMocked, uel, glucoseStatusProvider, repository) smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true) Mockito.doAnswer { invocation: InvocationOnMock -> val callback = invocation.getArgument(1) @@ -310,7 +295,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { `when`(sp.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)).thenReturn(true) //LOOP STATUS : disabled - PowerMockito.`when`(loopPlugin.enabled).thenReturn(false) + `when`(loopPlugin.enabled).thenReturn(false) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "LOOP STATUS") smsCommunicatorPlugin.processSms(sms) @@ -318,9 +303,9 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("Loop is disabled", smsCommunicatorPlugin.messages[1].text) //LOOP STATUS : suspended - PowerMockito.`when`(loopPlugin.minutesToEndOfSuspend()).thenReturn(10) - PowerMockito.`when`(loopPlugin.enabled).thenReturn(true) - PowerMockito.`when`(loopPlugin.isSuspended).thenReturn(true) + `when`(loopPlugin.minutesToEndOfSuspend()).thenReturn(10) + `when`(loopPlugin.enabled).thenReturn(true) + `when`(loopPlugin.isSuspended).thenReturn(true) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "LOOP STATUS") smsCommunicatorPlugin.processSms(sms) @@ -328,8 +313,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("Suspended (10 m)", smsCommunicatorPlugin.messages[1].text) //LOOP STATUS : enabled - PowerMockito.`when`(loopPlugin.enabled).thenReturn(true) - PowerMockito.`when`(loopPlugin.isSuspended).thenReturn(false) + `when`(loopPlugin.enabled).thenReturn(true) + `when`(loopPlugin.isSuspended).thenReturn(false) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "LOOP STATUS") smsCommunicatorPlugin.processSms(sms) @@ -338,7 +323,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("Loop is enabled", smsCommunicatorPlugin.messages[1].text) //LOOP : wrong format - PowerMockito.`when`(loopPlugin.enabled).thenReturn(true) + `when`(loopPlugin.enabled).thenReturn(true) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "LOOP") smsCommunicatorPlugin.processSms(sms) @@ -347,7 +332,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text) //LOOP DISABLE : already disabled - PowerMockito.`when`(loopPlugin.enabled).thenReturn(false) + `when`(loopPlugin.enabled).thenReturn(false) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "LOOP DISABLE") smsCommunicatorPlugin.processSms(sms) @@ -357,7 +342,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { //LOOP DISABLE : from enabled hasBeenRun = false - PowerMockito.`when`(loopPlugin.enabled).thenReturn(true) + `when`(loopPlugin.enabled).thenReturn(true) // PowerMockito.doAnswer(Answer { // hasBeenRun = true // null @@ -375,7 +360,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { //Assert.assertTrue(hasBeenRun) //LOOP ENABLE : already enabled - PowerMockito.`when`(loopPlugin.enabled).thenReturn(true) + `when`(loopPlugin.enabled).thenReturn(true) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "LOOP ENABLE") smsCommunicatorPlugin.processSms(sms) @@ -385,7 +370,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { //LOOP ENABLE : from disabled hasBeenRun = false - PowerMockito.`when`(loopPlugin.enabled).thenReturn(false) + `when`(loopPlugin.enabled).thenReturn(false) // PowerMockito.doAnswer(Answer { // hasBeenRun = true // null @@ -479,8 +464,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text) //NSCLIENT RESTART - PowerMockito.`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true) - PowerMockito.`when`(loopPlugin.isSuspended).thenReturn(false) + `when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true) + `when`(loopPlugin.isSuspended).thenReturn(false) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "NSCLIENT RESTART") smsCommunicatorPlugin.processSms(sms) @@ -489,8 +474,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertTrue(smsCommunicatorPlugin.messages[1].text.contains("NSCLIENT RESTART")) //NSCLIENT BLA BLA - PowerMockito.`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true) - PowerMockito.`when`(loopPlugin.isSuspended).thenReturn(false) + `when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true) + `when`(loopPlugin.isSuspended).thenReturn(false) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "NSCLIENT BLA BLA") smsCommunicatorPlugin.processSms(sms) @@ -499,8 +484,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text) //NSCLIENT BLABLA - PowerMockito.`when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true) - PowerMockito.`when`(loopPlugin.isSuspended).thenReturn(false) + `when`(loopPlugin.isEnabled(PluginType.LOOP)).thenReturn(true) + `when`(loopPlugin.isSuspended).thenReturn(false) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "NSCLIENT BLABLA") smsCommunicatorPlugin.processSms(sms) @@ -536,7 +521,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { repository.runTransactionForResult(anyObject>()) ).thenReturn(Single.just(CancelCurrentOfflineEventIfAnyTransaction.TransactionResult().apply { })) - PowerMockito.`when`(loopPlugin.enabled).thenReturn(true) + `when`(loopPlugin.enabled).thenReturn(true) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "PUMP CONNECT") smsCommunicatorPlugin.processSms(sms) @@ -902,7 +887,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("BOLUS", smsCommunicatorPlugin.messages[0].text) Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text) `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(1.0)) - PowerMockito.`when`(dateUtilMocked.now()).thenReturn(1000L) + `when`(dateUtilMocked.now()).thenReturn(1000L) `when`(sp.getLong(R.string.key_smscommunicator_remotebolusmindistance, T.msecs(Constants.remoteBolusMinDistance).mins())).thenReturn(15L) //BOLUS 1 smsCommunicatorPlugin.messages = ArrayList() @@ -911,7 +896,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { Assert.assertEquals("BOLUS 1", smsCommunicatorPlugin.messages[0].text) Assert.assertEquals("Remote bolus not available. Try again later.", smsCommunicatorPlugin.messages[1].text) `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) - PowerMockito.`when`(dateUtilMocked.now()).thenReturn(Constants.remoteBolusMinDistance + 1002L) + `when`(dateUtilMocked.now()).thenReturn(Constants.remoteBolusMinDistance + 1002L) //BOLUS 0 smsCommunicatorPlugin.messages = ArrayList() @@ -942,13 +927,13 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { //BOLUS 1 (Suspended pump) smsCommunicatorPlugin.lastRemoteBolusTime = 0 - PowerMockito.`when`(virtualPumpPlugin.isSuspended()).thenReturn(true) + `when`(virtualPumpPlugin.isSuspended()).thenReturn(true) smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "BOLUS 1") smsCommunicatorPlugin.processSms(sms) Assert.assertEquals("BOLUS 1", smsCommunicatorPlugin.messages[0].text) Assert.assertEquals("Pump suspended", smsCommunicatorPlugin.messages[1].text) - PowerMockito.`when`(virtualPumpPlugin.isSuspended()).thenReturn(false) + `when`(virtualPumpPlugin.isSuspended()).thenReturn(false) //BOLUS 1 a smsCommunicatorPlugin.messages = ArrayList() @@ -993,7 +978,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { smsCommunicatorPlugin.processSms(sms) Assert.assertEquals("CAL 0", smsCommunicatorPlugin.messages[0].text) Assert.assertEquals("Wrong format", smsCommunicatorPlugin.messages[1].text) - PowerMockito.`when`(xdripCalibrations.sendIntent(ArgumentMatchers.anyDouble())).thenReturn(true) + `when`(xdripCalibrations.sendIntent(ArgumentMatchers.anyDouble())).thenReturn(true) //CAL 1 smsCommunicatorPlugin.messages = ArrayList() sms = Sms("1234", "CAL 1") @@ -1007,7 +992,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { } @Test fun processCarbsTest() { - PowerMockito.`when`(dateUtilMocked.now()).thenReturn(1000000L) + `when`(dateUtilMocked.now()).thenReturn(1000000L) `when`(sp.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)).thenReturn(false) //CAL smsCommunicatorPlugin.messages = ArrayList() diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsTest.kt index 8224865402..75e2d0b602 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsTest.kt @@ -4,19 +4,15 @@ import android.telephony.SmsMessage import info.nightscout.androidaps.TestBase 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 +import org.mockito.Mockito +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(SmsMessage::class) class SmsTest : TestBase() { @Test fun doTests() { - val smsMessage = PowerMockito.mock(SmsMessage::class.java) - PowerMockito.`when`(smsMessage.originatingAddress).thenReturn("aNumber") - PowerMockito.`when`(smsMessage.messageBody).thenReturn("aBody") + val smsMessage = Mockito.mock(SmsMessage::class.java) + `when`(smsMessage.originatingAddress).thenReturn("aNumber") + `when`(smsMessage.messageBody).thenReturn("aBody") var sms = Sms(smsMessage) Assert.assertEquals(sms.phoneNumber, "aNumber") Assert.assertEquals(sms.text, "aBody") diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/tidepool/comm/SessionTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/tidepool/comm/SessionTest.kt index b172447cec..f7af8d995b 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/tidepool/comm/SessionTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/tidepool/comm/SessionTest.kt @@ -5,10 +5,7 @@ import info.nightscout.androidaps.plugins.general.tidepool.messages.DatasetReply import org.junit.Assert.assertEquals import org.junit.Assert.assertNull import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class SessionTest { @Test fun populateBody() { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPluginUTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPluginUTest.kt index 53b4bc6086..3cae396031 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPluginUTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPluginUTest.kt @@ -1,7 +1,6 @@ package info.nightscout.androidaps.plugins.pump.virtual import dagger.android.AndroidInjector -import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.CommandQueueProvider @@ -12,19 +11,15 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(FabricPrivacy::class, DateUtil::class) class VirtualPumpPluginUTest : TestBase() { private val rxBus = RxBusWrapper(aapsSchedulers) @@ -46,16 +41,16 @@ class VirtualPumpPluginUTest : TestBase() { @Test fun refreshConfiguration() { - PowerMockito.`when`(sp.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") + `when`(sp.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") virtualPumpPlugin.refreshConfiguration() Assert.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType) } @Test fun refreshConfigurationTwice() { - PowerMockito.`when`(sp.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") + `when`(sp.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") virtualPumpPlugin.refreshConfiguration() - PowerMockito.`when`(sp.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") + `when`(sp.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo") virtualPumpPlugin.refreshConfiguration() Assert.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType) } 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 40b5520720..a35ff07f17 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,11 +13,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.json.JSONObject import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class AbstractSensitivityPluginTest : TestBase() { @Mock lateinit var pluginDescription: PluginDescription diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/source/MM640GPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/source/MM640GPluginTest.kt index e2471d6acf..a1c98901c8 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/source/MM640GPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/source/MM640GPluginTest.kt @@ -8,11 +8,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MM640GPluginTest : TestBase() { private lateinit var mM640gPlugin: MM640gPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/source/NSClientPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/source/NSClientPluginTest.kt index ebd1e14b03..0a1211596e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/source/NSClientPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/source/NSClientPluginTest.kt @@ -1,18 +1,15 @@ package info.nightscout.androidaps.plugins.source import dagger.android.AndroidInjector -import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.TestBase +import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class NSClientPluginTest : TestBase() { private lateinit var nsClientSourcePlugin: NSClientSourcePlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/source/XdripPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/source/XdripPluginTest.kt index ed1dc9c91d..8b49149b3d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/source/XdripPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/source/XdripPluginTest.kt @@ -3,16 +3,12 @@ package info.nightscout.androidaps.plugins.source import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase -import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class XdripPluginTest : TestBase() { private lateinit var xdripPlugin: XdripPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPluginTest.kt index 5167b1195b..a8c38819de 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPluginTest.kt @@ -4,17 +4,11 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.database.AppRepository -import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner @Suppress("SpellCheckingInspection") -@RunWith(PowerMockRunner::class) -@PrepareForTest(FabricPrivacy::class, AppRepository::class) class TreatmentsPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt index 3d64fc8b3a..53059c931f 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt @@ -19,11 +19,9 @@ import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider -import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.queue.commands.* import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -33,19 +31,11 @@ import io.reactivex.Single import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` import org.mockito.Mockito.anyLong -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.util.* -@RunWith(PowerMockRunner::class) -@PrepareForTest( - ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class, - FabricPrivacy::class, PrefFileListProvider::class, PowerManager::class, - AppRepository::class) class CommandQueueTest : TestBaseWithProfile() { @Mock lateinit var constraintChecker: ConstraintChecker diff --git a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt index 22ddbebd53..9319ba7a63 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt @@ -13,27 +13,17 @@ import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider -import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute -import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest( - ConstraintChecker::class, VirtualPumpPlugin::class, ToastUtils::class, Context::class, - FabricPrivacy::class, PrefFileListProvider::class, PowerManager::class) class QueueThreadTest : TestBaseWithProfile() { @Mock lateinit var constraintChecker: ConstraintChecker diff --git a/app/src/test/java/info/nightscout/androidaps/utils/SntpClientTest.kt b/app/src/test/java/info/nightscout/androidaps/utils/SntpClientTest.kt index 5224a6129c..04f0156e77 100644 --- a/app/src/test/java/info/nightscout/androidaps/utils/SntpClientTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/utils/SntpClientTest.kt @@ -3,14 +3,8 @@ package info.nightscout.androidaps.utils import info.nightscout.androidaps.TestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner - -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class SntpClientTest : TestBase() { @Mock lateinit var dateUtil: DateUtil diff --git a/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt b/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt index 38fd598f5e..8246239f76 100644 --- a/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/utils/wizard/BolusWizardTest.kt @@ -17,16 +17,11 @@ import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito import org.mockito.Mockito.`when` import org.mockito.invocation.InvocationOnMock -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, VirtualPumpPlugin::class, DateUtil::class, AutosensDataStore::class) class BolusWizardTest : TestBase() { private val pumpBolusStep = 0.1 diff --git a/automation/build.gradle b/automation/build.gradle index e3b5a31fa9..5e06a3e587 100644 --- a/automation/build.gradle +++ b/automation/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt index e730cd61a7..6fa4f2c439 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt @@ -5,6 +5,7 @@ import android.os.Handler import android.os.HandlerThread import android.os.SystemClock import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.events.* import info.nightscout.androidaps.interfaces.Config @@ -38,6 +39,7 @@ import javax.inject.Inject import javax.inject.Singleton import kotlin.collections.ArrayList +@OpenForTesting @Singleton class AutomationPlugin @Inject constructor( injector: HasAndroidInjector, diff --git a/automation/src/main/java/info/nightscout/androidaps/services/LastLocationDataContainer.kt b/automation/src/main/java/info/nightscout/androidaps/services/LastLocationDataContainer.kt index f546abb8cf..aa184ade9c 100644 --- a/automation/src/main/java/info/nightscout/androidaps/services/LastLocationDataContainer.kt +++ b/automation/src/main/java/info/nightscout/androidaps/services/LastLocationDataContainer.kt @@ -1,13 +1,11 @@ package info.nightscout.androidaps.services import android.location.Location +import info.nightscout.androidaps.annotations.OpenForTesting import javax.inject.Inject import javax.inject.Singleton -/** - * Created by adrian on 2020-01-06. - */ - +@OpenForTesting @Singleton class LastLocationDataContainer @Inject constructor() { var lastLocation: Location? = null diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/AutomationEventTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/AutomationEventTest.kt index 4f2fb7cd6b..cf77f4a972 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/AutomationEventTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/AutomationEventTest.kt @@ -14,11 +14,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper import org.json.JSONObject import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class AutomationEventTest : TestBase() { @Mock lateinit var loopPlugin: Loop @@ -48,7 +45,6 @@ class AutomationEventTest : TestBase() { val event = AutomationEvent(injector) event.title = "Test" event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest.oneItem)) - ?: throw Exception() event.addAction(ActionLoopEnable(injector)) // export to json diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/ComposeTriggerTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/ComposeTriggerTest.kt index 0422edc519..01ddca5cbe 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/ComposeTriggerTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/ComposeTriggerTest.kt @@ -8,12 +8,7 @@ import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerCon import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest class ComposeTriggerTest : TestBase() { var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } } diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt index e284c2c64e..1aa632efca 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt @@ -19,10 +19,8 @@ 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, AppRepository::class) open class TestBaseWithProfile : TestBase() { @Mock lateinit var activePluginProvider: ActivePlugin diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionAlarmTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionAlarmTest.kt index 9cafda9289..0aad1dd7ba 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionAlarmTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionAlarmTest.kt @@ -15,15 +15,10 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class, TimerUtil::class) class ActionAlarmTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopDisableTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopDisableTest.kt index 0a0aa4db2b..c50f16ea5a 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopDisableTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopDisableTest.kt @@ -1,20 +1,15 @@ package info.nightscout.androidaps.plugins.general.automation.actions import info.nightscout.androidaps.automation.R -import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginType -import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.queue.Callback import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionLoopDisableTest : ActionsTestBase() { lateinit var sut: ActionLoopDisable diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopEnableTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopEnableTest.kt index 21cc20b448..e7bc6e5320 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopEnableTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopEnableTest.kt @@ -1,18 +1,14 @@ package info.nightscout.androidaps.plugins.general.automation.actions import info.nightscout.androidaps.automation.R -import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.queue.Callback import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionLoopEnableTest : ActionsTestBase() { lateinit var sut: ActionLoopEnable diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResumeTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResumeTest.kt index 598fc9628c..e630a0df01 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResumeTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopResumeTest.kt @@ -9,11 +9,8 @@ import io.reactivex.Single import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionLoopResumeTest : ActionsTestBase() { lateinit var sut: ActionLoopResume diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspendTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspendTest.kt index ec4cfa0956..66140b09d0 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspendTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionLoopSuspendTest.kt @@ -6,13 +6,10 @@ import info.nightscout.androidaps.queue.Callback import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionLoopSuspendTest : ActionsTestBase() { lateinit var sut: ActionLoopSuspend diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionNotificationTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionNotificationTest.kt index 72a50156b8..d48c9683a1 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionNotificationTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionNotificationTest.kt @@ -6,23 +6,26 @@ import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.data.PumpEnactResult import info.nightscout.androidaps.database.AppRepository +import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction +import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction +import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction +import info.nightscout.androidaps.database.transactions.Transaction import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.automation.elements.InputString import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.resources.ResourceHelper +import io.reactivex.Completable +import io.reactivex.Single import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner +import org.mockito.Mockito.any +import org.mockito.Mockito.doNothing -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class) class ActionNotificationTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper @@ -47,7 +50,14 @@ class ActionNotificationTest : TestBase() { fun setup() { `when`(resourceHelper.gs(R.string.ok)).thenReturn("OK") `when`(resourceHelper.gs(R.string.notification)).thenReturn("Notification") - `when`(resourceHelper.gs(ArgumentMatchers.eq(R.string.notification_message), ArgumentMatchers.anyString())).thenReturn("Notification: %s") + `when`( + resourceHelper.gs( + ArgumentMatchers.eq(R.string.notification_message), + ArgumentMatchers.anyString() + ) + ).thenReturn("Notification: %s") + `when`(repository.runTransaction(anyObject>())) + .thenReturn(Completable.fromAction {}) sut = ActionNotification(injector) } @@ -81,7 +91,10 @@ class ActionNotificationTest : TestBase() { @Test fun toJSONTest() { sut.text = InputString("Asd") - Assert.assertEquals("{\"data\":{\"text\":\"Asd\"},\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.ActionNotification\"}", sut.toJSON()) + Assert.assertEquals( + "{\"data\":{\"text\":\"Asd\"},\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.ActionNotification\"}", + sut.toJSON() + ) } @Test fun fromJSONTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.kt index 9d201af7eb..60a109bd62 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchPercentTest.kt @@ -7,12 +7,9 @@ import info.nightscout.androidaps.queue.Callback import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionProfileSwitchPercentTest : ActionsTestBase() { private lateinit var sut: ActionProfileSwitchPercent diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchTest.kt index 6bf564425b..c15d1030b0 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionProfileSwitchTest.kt @@ -6,16 +6,13 @@ import info.nightscout.androidaps.queue.Callback import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers.anyLong import org.mockito.Mockito import org.mockito.Mockito.`when` import org.mockito.Mockito.anyInt import org.mockito.Mockito.anyString -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionProfileSwitchTest : ActionsTestBase() { private lateinit var sut: ActionProfileSwitch diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionSendSMSTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionSendSMSTest.kt index 476aabd460..cd2d36f941 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionSendSMSTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionSendSMSTest.kt @@ -6,13 +6,10 @@ import info.nightscout.androidaps.queue.Callback import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyString import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionSendSMSTest : ActionsTestBase() { private lateinit var sut: ActionSendSMS diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTargetTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTargetTest.kt index 55c5c13bdf..bca2b68ef4 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTargetTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTargetTest.kt @@ -12,12 +12,9 @@ import io.reactivex.Single import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionStartTempTargetTest : ActionsTestBase() { private lateinit var sut: ActionStartTempTarget diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStopTempTargetTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStopTempTargetTest.kt index 19e694a5d9..e3310ed65e 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStopTempTargetTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStopTempTargetTest.kt @@ -9,12 +9,9 @@ import io.reactivex.Single import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ActionStopTempTargetTest : ActionsTestBase() { private lateinit var sut: ActionStopTempTarget diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionTest.kt index ca61579dd8..d199e76bc2 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionTest.kt @@ -3,12 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.actions import org.json.JSONObject import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest class ActionTest : ActionsTestBase() { @Test diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt index 742e77cff1..38a2d884eb 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt @@ -9,7 +9,6 @@ import info.nightscout.androidaps.database.entities.OfflineEvent import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.automation.TestBaseWithProfile import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -17,9 +16,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Before import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -@PrepareForTest(RxBusWrapper::class, ActionsTestBase.TestLoopPlugin::class, UserEntryLogger::class) open class ActionsTestBase : TestBaseWithProfile() { open class TestLoopPlugin( @@ -36,7 +33,7 @@ open class ActionsTestBase : TestBaseWithProfile() { override val isSuspended: Boolean = suspended override var enabled: Boolean get() = true - set(value) {} + set(_) {} override fun minutesToEndOfSuspend(): Int = 0 diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorConnectTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorConnectTest.kt index 16db4a10c7..0842c232d8 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorConnectTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorConnectTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ComparatorConnectTest : TriggerTestBase() { @Test fun labelsTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExistsTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExistsTest.kt index 94a00c6833..1011db6565 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExistsTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorExistsTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ComparatorExistsTest : TriggerTestBase() { @Test fun labelsTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorTest.kt index e33ade173f..71b8fc4233 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/ComparatorTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class ComparatorTest : TriggerTestBase() { @Test diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBgTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBgTest.kt index b84e1e5ff5..ee20a8e851 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBgTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputBgTest.kt @@ -1,16 +1,12 @@ package info.nightscout.androidaps.plugins.general.automation.elements -import info.nightscout.androidaps.Constants import info.nightscout.androidaps.interfaces.GlucoseUnit import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class InputBgTest : TriggerTestBase() { @Test diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDurationTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDurationTest.kt index f1becea887..424efd6d36 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDurationTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputDurationTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class InputDurationTest : TriggerTestBase() { @Test fun setValueTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulinTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulinTest.kt index f4f8c8b770..c2b2c53ceb 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulinTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputInsulinTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class InputInsulinTest : TriggerTestBase() { @Test fun setValueTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercentTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercentTest.kt index 1cf2e8e0df..a75c044cf7 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercentTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputPercentTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class InputPercentTest : TriggerTestBase() { @Test fun setValueTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileNameTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileNameTest.kt index 1566a3e1af..26f0b69976 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileNameTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputProfileNameTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class InputProfileNameTest : TriggerTestBase() { @Test fun setValue() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputStringTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputStringTest.kt index 6a8ce2d94b..7bce11b606 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputStringTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputStringTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class InputStringTest : TriggerTestBase() { @Test fun setValueTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTargetTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTargetTest.kt index d5a8b89e93..6690a7a017 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTargetTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/InputTempTargetTest.kt @@ -1,16 +1,10 @@ package info.nightscout.androidaps.plugins.general.automation.elements -import info.nightscout.androidaps.Constants import info.nightscout.androidaps.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class InputTempTargetTest : TriggerTestBase() { @Test fun setValueTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LabelWithElementTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LabelWithElementTest.kt index 57a3f5676c..5ccdb971ed 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LabelWithElementTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LabelWithElementTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class LabelWithElementTest : TriggerTestBase() { @Test diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LayoutBuilderTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LayoutBuilderTest.kt index a81b5506be..76b1e01d42 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LayoutBuilderTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/LayoutBuilderTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class LayoutBuilderTest : TestBase() { val injector = HasAndroidInjector { AndroidInjector { } } diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabelTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabelTest.kt index 15eaa50c5e..0f5a9edda5 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabelTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabelTest.kt @@ -5,11 +5,8 @@ import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDum import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class StaticLabelTest : TriggerTestBase() { @Test fun constructor() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAutosensValueTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAutosensValueTest.kt index 39ddf09fde..ab2563b0d7 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAutosensValueTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerAutosensValueTest.kt @@ -4,21 +4,14 @@ import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.plugins.general.automation.elements.Comparator import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mockito 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(DateUtil::class) class TriggerAutosensValueTest : TriggerTestBase() { var now = 1514766900000L @@ -65,14 +58,14 @@ class TriggerAutosensValueTest : TriggerTestBase() { t.autosens.value = 390.0 t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER Assert.assertTrue(t.shouldRun()) - PowerMockito.`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(AutosensData(injector)) + `when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(AutosensData(injector)) t = TriggerAutosensValue(injector) t.autosens.value = 80.0 t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER Assert.assertFalse(t.shouldRun()) // Test autosensData == null and Comparator == IS_NOT_AVAILABLE - PowerMockito.`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(null) + `when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(null) t = TriggerAutosensValue(injector) t.comparator.value = Comparator.Compare.IS_NOT_AVAILABLE Assert.assertTrue(t.shouldRun()) @@ -114,7 +107,7 @@ class TriggerAutosensValueTest : TriggerTestBase() { @Before fun mock() { - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } private fun generateAutosensData(): AutosensData { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDeviceTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDeviceTest.kt index 47b98b582d..4ddeded933 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDeviceTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDeviceTest.kt @@ -6,11 +6,8 @@ import info.nightscout.androidaps.plugins.general.automation.elements.Comparator import org.json.JSONObject import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner @Suppress("SpellCheckingInspection") -@RunWith(PowerMockRunner::class) class TriggerBTDeviceTest : TriggerTestBase() { var now = 1514766900000L diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.kt index 76d1980ac0..e9ee52718f 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.kt @@ -1,25 +1,17 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import com.google.common.base.Optional -import info.nightscout.androidaps.Constants import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.automation.elements.Comparator -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 import java.util.* -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class, ProfileFunction::class) class TriggerBgTest : TriggerTestBase() { var now = 1514766900000L diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt index 29beab1464..11d2b392c6 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt @@ -4,27 +4,20 @@ import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.database.entities.Bolus import info.nightscout.androidaps.plugins.general.automation.elements.Comparator -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONException import org.json.JSONObject import org.junit.Assert import org.junit.Before 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(DateUtil::class) class TriggerBolusAgoTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } @Test diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerCOBTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerCOBTest.kt index d125ee5655..1176417304 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerCOBTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerCOBTest.kt @@ -4,31 +4,25 @@ import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.plugins.general.automation.elements.Comparator import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class TriggerCOBTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.`when`(dateUtil.now()).thenReturn(now) - PowerMockito.`when`(sp.getInt(ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt())).thenReturn(48) + `when`(dateUtil.now()).thenReturn(now) + `when`(sp.getInt(ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt())).thenReturn(48) } @Test fun shouldRunTest() { // COB value is 6 - PowerMockito.`when`(iobCobCalculator.getCobInfo(false, "AutomationTriggerCOB")).thenReturn(CobInfo(0, 6.0, 2.0)) + `when`(iobCobCalculator.getCobInfo(false, "AutomationTriggerCOB")).thenReturn(CobInfo(0, 6.0, 2.0)) var t: TriggerCOB = TriggerCOB(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL) Assert.assertFalse(t.shouldRun()) t = TriggerCOB(injector).setValue(6.0).comparator(Comparator.Compare.IS_EQUAL) diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnectorTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnectorTest.kt index 74754f924e..f43006c6d9 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnectorTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnectorTest.kt @@ -4,10 +4,7 @@ import org.json.JSONException import org.json.JSONObject import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class TriggerConnectorTest : TriggerTestBase() { @Test fun testTriggerList() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerDeltaTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerDeltaTest.kt index 964cbb5e0f..9f23dffbfc 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerDeltaTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerDeltaTest.kt @@ -1,34 +1,25 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import com.google.common.base.Optional -import info.nightscout.androidaps.Constants import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.interfaces.GlucoseUnit -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.general.automation.elements.Comparator import info.nightscout.androidaps.plugins.general.automation.elements.InputDelta.DeltaType -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 import java.util.* -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class, ProfileFunction::class) class TriggerDeltaTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) `when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL) } diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerIobTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerIobTest.kt index af3a608550..cb554535e2 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerIobTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerIobTest.kt @@ -4,19 +4,13 @@ import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.data.IobTotal import info.nightscout.androidaps.plugins.general.automation.elements.Comparator -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class TriggerIobTest : TriggerTestBase() { var now = 1514766900000L diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocationTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocationTest.kt index c533c8f257..8f80672065 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocationTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerLocationTest.kt @@ -4,29 +4,19 @@ import android.location.Location import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.plugins.general.automation.elements.InputLocationMode -import info.nightscout.androidaps.services.LocationService -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONException import org.json.JSONObject import org.junit.Assert import org.junit.Before 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(DateUtil::class, LocationService::class) class TriggerLocationTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.mockStatic(LocationService::class.java) `when`(dateUtil.now()).thenReturn(now) - PowerMockito.spy(LocationService::class.java) `when`(locationDataContainer.lastLocation).thenReturn(mockedLocation()) } diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercentTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercentTest.kt index 27c910ca78..d1343adf6c 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercentTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerProfilePercentTest.kt @@ -3,27 +3,20 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.plugins.general.automation.elements.Comparator -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONException import org.json.JSONObject import org.junit.Assert import org.junit.Before 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(DateUtil::class) class TriggerProfilePercentTest : TriggerTestBase() { private val now = 1514766900000L @Before fun mock() { `when`(profileFunction.getProfile()).thenReturn(validProfile) - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } @Test fun shouldRunTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerPumpLastConnectionTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerPumpLastConnectionTest.kt index bddce94217..1bd94e4e25 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerPumpLastConnectionTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerPumpLastConnectionTest.kt @@ -3,25 +3,19 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.plugins.general.automation.elements.Comparator -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class TriggerPumpLastConnectionTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } @Test @@ -29,7 +23,7 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() { // System.currentTimeMillis() is always 0 // and so is every last connection time Assert.assertEquals(0L, testPumpPlugin.lastDataTime()) - PowerMockito.`when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min + `when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min var t = TriggerPumpLastConnection(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL) Assert.assertEquals(110, t.minutesAgo.value) Assert.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value) diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTimeTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTimeTest.kt index e764e22747..e63ec3118b 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTimeTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTimeTest.kt @@ -1,26 +1,20 @@ package info.nightscout.androidaps.plugins.general.automation.triggers -import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.androidaps.utils.T import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class TriggerRecurringTimeTest : TriggerTestBase() { var now : Long = 0L @Before fun mock() { now = MidnightTime.calc() + T.mins(95).msecs() // 95 min from midnight - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } @Test fun shouldRunTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTargetTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTargetTest.kt index 64ba71fd14..7960208905 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTargetTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTempTargetTest.kt @@ -3,24 +3,18 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.plugins.general.automation.elements.ComparatorExists -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class TriggerTempTargetTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } /* @Test fun shouldRunTest() { @@ -29,7 +23,7 @@ class TriggerTempTargetTest : TriggerTestBase() { Assert.assertFalse(t.shouldRun()) t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS) Assert.assertTrue(t.shouldRun()) - PowerMockito.`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(TemporaryTarget(duration = 0, highTarget = 0.0, lowTarget = 0.0, reason = TemporaryTarget.Reason.CUSTOM, timestamp = 0)) + `when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(TemporaryTarget(duration = 0, highTarget = 0.0, lowTarget = 0.0, reason = TemporaryTarget.Reason.CUSTOM, timestamp = 0)) t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS) Assert.assertFalse(t.shouldRun()) t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS) diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt index 350b987dbd..dcd98a45e9 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTestBase.kt @@ -3,13 +3,13 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.plugins.general.automation.TestBaseWithProfile import info.nightscout.androidaps.TestPumpPlugin import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin +import info.nightscout.androidaps.plugins.general.automation.TestBaseWithProfile import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.receivers.ReceiverStatusStore @@ -18,9 +18,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Before import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -@PrepareForTest(LastLocationDataContainer::class, AutomationPlugin::class, AutosensDataStore::class) open class TriggerTestBase : TestBaseWithProfile() { @Mock lateinit var sp: SP diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRangeTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRangeTest.kt index 3e01059aa6..55e31d328f 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRangeTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeRangeTest.kt @@ -2,19 +2,13 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import com.google.common.base.Optional import info.nightscout.androidaps.automation.R -import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.MidnightTime import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class TriggerTimeRangeTest : TriggerTestBase() { var now = 754 // in minutes from midnight @@ -23,7 +17,7 @@ class TriggerTimeRangeTest : TriggerTestBase() { @Before fun mock() { val nowMills = MidnightTime.calcPlusMinutes(now) - PowerMockito.`when`(dateUtil.now()).thenReturn(nowMills) + `when`(dateUtil.now()).thenReturn(nowMills) } @Test diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.kt index 8c38c37761..24f7fc9932 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.kt @@ -2,26 +2,20 @@ package info.nightscout.androidaps.plugins.general.automation.triggers import com.google.common.base.Optional import info.nightscout.androidaps.automation.R -import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.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.runner.RunWith -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class) class TriggerTimeTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } @Test fun shouldRunTest() { diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerWifiSsidTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerWifiSsidTest.kt index 4b38476f98..3e7fe4549e 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerWifiSsidTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerWifiSsidTest.kt @@ -4,27 +4,19 @@ import com.google.common.base.Optional import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.events.EventNetworkChange import info.nightscout.androidaps.plugins.general.automation.elements.Comparator -import info.nightscout.androidaps.receivers.NetworkChangeReceiver -import info.nightscout.androidaps.utils.DateUtil import org.json.JSONException import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 +import org.mockito.Mockito.`when` -@RunWith(PowerMockRunner::class) -@PrepareForTest(NetworkChangeReceiver::class, DateUtil::class) class TriggerWifiSsidTest : TriggerTestBase() { var now = 1514766900000L @Before fun mock() { - PowerMockito.mockStatic(NetworkChangeReceiver::class.java) - PowerMockito.`when`(dateUtil.now()).thenReturn(now) + `when`(dateUtil.now()).thenReturn(now) } @Test fun shouldRunTest() { diff --git a/build.gradle b/build.gradle index 687485d3fe..6adb64a5e9 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext { - kotlin_version = '1.5.30' + kotlin_version = '1.5.31' coreVersion = '1.6.0' rxjava_version = '2.2.21' rxandroid_version = '2.1.1' @@ -21,17 +21,16 @@ buildscript { preferencektx_version = '1.1.1' commonslang3_version = '3.11' commonscodec_version = '1.15' - jodatime_version = '2.10.10' + jodatime_version = '2.10.11' work_version = '2.5.0' tink_version = '1.5.0' junit_version = '4.13.2' mockitoVersion = '3.12.4' - powermockVersion = '2.0.9' dexmakerVersion = "1.2" retrofit2Version = '2.9.0' okhttp3Version = '4.9.0' - byteBuddyVersion = '1.11.13' + byteBuddyVersion = '1.11.18' androidx_junit = '1.1.2' androidx_rules = '1.4.0-alpha04' diff --git a/combo/build.gradle b/combo/build.gradle index 6e8a0ec0c6..c81f96b15c 100644 --- a/combo/build.gradle +++ b/combo/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt index e164ace6e2..20397ef6e6 100644 --- a/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt +++ b/combo/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt @@ -15,14 +15,9 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(Context::class) class ComboPluginTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper diff --git a/core/build.gradle b/core/build.gradle index c56fb46cb5..8f3db0440e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -14,8 +14,3 @@ apply from: "${project.rootDir}/gradle/jacoco_global.gradle" dependencies { implementation project(':database') } - -allOpen { - // allows mocking for classes w/o directly opening them for release builds - annotation 'info.nightscout.androidaps.annotations.OpenForTesting' -} \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/di/CoreModule.kt b/core/src/main/java/info/nightscout/androidaps/di/CoreModule.kt index 45aa71abeb..556f473524 100644 --- a/core/src/main/java/info/nightscout/androidaps/di/CoreModule.kt +++ b/core/src/main/java/info/nightscout/androidaps/di/CoreModule.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.di import android.content.Context +import android.telephony.SmsManager import androidx.preference.PreferenceManager import dagger.Module import dagger.Provides @@ -32,4 +33,7 @@ open class CoreModule { @Singleton fun provideAAPSLogger(l: L): AAPSLogger = AAPSLoggerProduction(l) + @Provides + fun smsManager() : SmsManager = SmsManager.getDefault() + } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt b/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt index 9bed01b2f0..3e0e70efcb 100644 --- a/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt +++ b/core/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.logging +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.entities.UserEntry.Action @@ -14,6 +15,7 @@ import io.reactivex.rxkotlin.subscribeBy import javax.inject.Inject import javax.inject.Singleton +@OpenForTesting @Singleton class UserEntryLogger @Inject constructor( private val aapsLogger: AAPSLogger, diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt index 718956c90b..3b47c4670a 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConstraintChecker.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.plugins.configBuilder import info.nightscout.androidaps.Constants +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.interfaces.Profile import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Constraint @@ -9,6 +10,7 @@ import info.nightscout.androidaps.interfaces.PluginType import javax.inject.Inject import javax.inject.Singleton +@OpenForTesting @Singleton class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlugin) : Constraints { diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt index 189251db92..d4355cbb53 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.general.maintenance import android.content.Context import android.os.Environment +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.core.R import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils @@ -19,6 +20,7 @@ import javax.inject.Singleton import kotlin.math.abs @Suppress("SpellCheckingInspection") +@OpenForTesting @Singleton class PrefFileListProvider @Inject constructor( private val resourceHelper: ResourceHelper, diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt index 5cbfe021a3..4a2a20edbd 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator import androidx.collection.LongSparseArray +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.data.InMemoryGlucoseValue import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue @@ -14,6 +15,7 @@ import info.nightscout.androidaps.utils.T import kotlin.math.abs import kotlin.math.roundToLong +@OpenForTesting class AutosensDataStore { private val dataLock = Any() diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt index ba1609c579..9bef19b5c2 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt @@ -11,6 +11,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag +import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification @@ -30,7 +31,8 @@ class PumpSyncImplementation @Inject constructor( private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, private val profileFunction: ProfileFunction, - private val repository: AppRepository + private val repository: AppRepository, + private val uel: UserEntryLogger ) : PumpSync { private val disposable = CompositeDisposable() @@ -213,6 +215,7 @@ class PumpSyncImplementation @Inject constructor( pumpType = pumpType.toDbPumpType(), pumpSerial = pumpSerial) ) + uel.log(UserEntry.Action.CAREPORTAL, pumpType.source, note, ValueWithUnit.Timestamp(timestamp), ValueWithUnit.TherapyEventType(type.toDBbEventType())) repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(therapyEvent)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving TherapyEvent", it) diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt index 57a732cbc3..41e55e4844 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/DetailedBolusInfoStorage.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.common.bolusInfo +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -9,6 +10,7 @@ import javax.inject.Inject import javax.inject.Singleton import kotlin.math.abs +@OpenForTesting @Singleton class DetailedBolusInfoStorage @Inject constructor( val aapsLogger: AAPSLogger diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt index 0a5ac50f67..78c074e41a 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/bolusInfo/TemporaryBasalStorage.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.common.bolusInfo +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -9,6 +10,7 @@ import javax.inject.Inject import javax.inject.Singleton import kotlin.math.abs +@OpenForTesting @Singleton class TemporaryBasalStorage @Inject constructor( val aapsLogger: AAPSLogger diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt index 88d268b6f1..daadd2dc78 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.common.defs import info.nightscout.androidaps.core.R import info.nightscout.androidaps.database.embedments.InterfaceIDs +import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.plugins.common.ManufacturerType import info.nightscout.androidaps.utils.Round import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -50,7 +51,8 @@ enum class PumpType { baseBasalMinValue = 0.01, baseBasalStep = 0.01, baseBasalSpecialSteps = DoseStepSize.ComboBasal, - pumpCapability = PumpCapability.ComboCapabilities), + pumpCapability = PumpCapability.ComboCapabilities, + source = Sources.Combo), ACCU_CHEK_SPIRIT(description = "Accu-Chek Spirit", manufacturer = ManufacturerType.Roche, model = "Spirit", @@ -90,7 +92,8 @@ enum class PumpType { baseBasalMaxValue = null, baseBasalStep = 0.01, baseBasalSpecialSteps = DoseStepSize.InsightBasal, - pumpCapability = PumpCapability.InsightCapabilities), + pumpCapability = PumpCapability.InsightCapabilities, + source = Sources.Insight), ACCU_CHEK_SOLO(description = "Accu-Chek Solo", manufacturer = ManufacturerType.Roche, model = "Solo", @@ -133,7 +136,8 @@ enum class PumpType { baseBasalMinValue = 0.04, baseBasalStep = 0.01, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.DanaCapabilities), + pumpCapability = PumpCapability.DanaCapabilities, + source = Sources.DanaR), DANA_R_KOREAN(description = "DanaR Korean", manufacturer = ManufacturerType.Sooil, model = "DanaRKorean", @@ -146,7 +150,8 @@ enum class PumpType { baseBasalMinValue = 0.1, baseBasalStep = 0.01, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.DanaCapabilities), + pumpCapability = PumpCapability.DanaCapabilities, + source = Sources.DanaRC), DANA_RS(description = "DanaRS", manufacturer = ManufacturerType.Sooil, model = "DanaRS", @@ -159,10 +164,11 @@ enum class PumpType { baseBasalMinValue = 0.04, baseBasalStep = 0.01, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.DanaWithHistoryCapabilities), + pumpCapability = PumpCapability.DanaWithHistoryCapabilities, + source = Sources.DanaRS), DANA_RS_KOREAN(description = "DanaRSKorean", model = "DanaRSKorean", parent = DANA_RS), - DANA_I(description = "DanaI", model = "DanaI", parent = DANA_RS), - DANA_RV2(description = "DanaRv2", model = "DanaRv2", parent = DANA_RS), + DANA_I(description = "DanaI", model = "DanaI", parent = DANA_RS, source = Sources.DanaI), + DANA_RV2(description = "DanaRv2", model = "DanaRv2", parent = DANA_RS, source = Sources.DanaRv2), OMNIPOD_EROS(description = "Omnipod Eros", manufacturer = ManufacturerType.Insulet, model = "Eros", @@ -177,7 +183,8 @@ enum class PumpType { baseBasalStep = 0.05, baseBasalSpecialSteps = null, pumpCapability = PumpCapability.OmnipodCapabilities, - hasCustomUnreachableAlertCheck = true), + hasCustomUnreachableAlertCheck = true, + source = Sources.OmnipodEros), OMNIPOD_DASH(description = "Omnipod Dash", manufacturer = ManufacturerType.Insulet, model = "Dash", @@ -205,7 +212,8 @@ enum class PumpType { baseBasalMinValue = 0.05, baseBasalStep = 0.05, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.MedtronicCapabilities), + pumpCapability = PumpCapability.MedtronicCapabilities, + source = Sources.Medtronic), MEDTRONIC_515_715(description = "Medtronic 515/715", model = "515/715", parent = MEDTRONIC_512_712), @@ -224,7 +232,8 @@ enum class PumpType { baseBasalMinValue = 0.025, baseBasalStep = 0.025, baseBasalSpecialSteps = DoseStepSize.MedtronicVeoBasal, - pumpCapability = PumpCapability.MedtronicCapabilities), + pumpCapability = PumpCapability.MedtronicCapabilities, + source = Sources.Medtronic), MEDTRONIC_554_754_VEO(description = "Medtronic 554/754 (Veo)", model = "554/754 (Veo)", parent = MEDTRONIC_523_723_REVEL), MEDTRONIC_640G(description = "Medtronic 640G", manufacturer = ManufacturerType.Medtronic, @@ -284,7 +293,8 @@ enum class PumpType { model = "USER", tbrSettings = DoseSettings(1.0, 15, 24 * 60, 0.0, 500.0), extendedBolusSettings = DoseSettings(0.1, 15, 12 * 60, 0.1), - pumpCapability = PumpCapability.MDI), + pumpCapability = PumpCapability.MDI, + source = Sources.MDI), //Diaconn Pump DIACONN_G8(description = "DiaconnG8", @@ -300,7 +310,8 @@ enum class PumpType { baseBasalMaxValue = 3.0, baseBasalStep = 0.01, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.DanaWithHistoryCapabilities); + pumpCapability = PumpCapability.DanaWithHistoryCapabilities, + source = Sources.DiaconnG8); val description: String var manufacturer: ManufacturerType? = null @@ -342,6 +353,7 @@ enum class PumpType { var hasCustomUnreachableAlertCheck = false private set private var parent: PumpType? = null + val source: Sources companion object { @@ -349,9 +361,10 @@ enum class PumpType { values().firstOrNull { it.description == desc } ?: GENERIC_AAPS } - constructor(description: String, model: String, parent: PumpType, pumpCapability: PumpCapability? = null) { + constructor(description: String, model: String, parent: PumpType, pumpCapability: PumpCapability? = null, source: Sources? = null) { this.description = description this.parent = parent + this.source = source ?: parent.source this.pumpCapability = pumpCapability parent.model = model } @@ -370,7 +383,8 @@ enum class PumpType { baseBasalStep: Double = 1.0, baseBasalSpecialSteps: DoseStepSize? = null, pumpCapability: PumpCapability, - hasCustomUnreachableAlertCheck: Boolean = false) { + hasCustomUnreachableAlertCheck: Boolean = false, + source: Sources = Sources.VirtualPump) { this.description = description this.manufacturer = manufacturer this.model = model @@ -386,6 +400,7 @@ enum class PumpType { this.baseBasalSpecialSteps = baseBasalSpecialSteps this.pumpCapability = pumpCapability this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck + this.source = source } fun getFullDescription(i18nTemplate: String, hasExtendedBasals: Boolean, resourceHelper: ResourceHelper): String { diff --git a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt index 36b4705a13..fa71db66b4 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/Translator.kt @@ -264,6 +264,8 @@ class Translator @Inject internal constructor( Sources.DanaRC -> TODO() Sources.DanaRv2 -> TODO() Sources.DanaRS -> TODO() + Sources.DanaI -> TODO() + Sources.DiaconnG8 -> TODO() Sources.Insight -> TODO() Sources.Combo -> TODO() Sources.Medtronic -> TODO() diff --git a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt index 2863d007d2..fb667823e4 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt @@ -129,6 +129,8 @@ class UserEntryMapper { DanaRC (UserEntry.Sources.DanaRC), DanaRv2 (UserEntry.Sources.DanaRv2), DanaRS (UserEntry.Sources.DanaRS), + DanaI (UserEntry.Sources.DanaI), + DiaconnG8 (UserEntry.Sources.DiaconnG8), Insight (UserEntry.Sources.Insight), Combo (UserEntry.Sources.Combo), Medtronic (UserEntry.Sources.Medtronic), diff --git a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt index 6b46b1001d..f2627a3d55 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt @@ -83,6 +83,8 @@ class UserEntryPresentationHelper @Inject constructor( Sources.DanaRC -> R.drawable.ic_danars_128 Sources.DanaRv2 -> R.drawable.ic_danars_128 Sources.DanaRS -> R.drawable.ic_danars_128 + Sources.DanaI -> R.drawable.ic_danai_128 + Sources.DiaconnG8 -> R.drawable.ic_diaconn_g8 Sources.Insight -> R.drawable.ic_insight_128 Sources.Combo -> R.drawable.ic_combo_128 Sources.Medtronic -> R.drawable.ic_veo_128 diff --git a/diaconn/src/main/res/drawable/ic_diaconn_g8.xml b/core/src/main/res/drawable/ic_diaconn_g8.xml similarity index 100% rename from diaconn/src/main/res/drawable/ic_diaconn_g8.xml rename to core/src/main/res/drawable/ic_diaconn_g8.xml diff --git a/core/src/main/res/values-af-rZA/strings.xml b/core/src/main/res/values-af-rZA/strings.xml index e08ed0b349..18e6316bf4 100644 --- a/core/src/main/res/values-af-rZA/strings.xml +++ b/core/src/main/res/values-af-rZA/strings.xml @@ -59,4 +59,5 @@ + diff --git a/core/src/main/res/values-bg-rBG/strings.xml b/core/src/main/res/values-bg-rBG/strings.xml index 13f1cbb625..659c20aba1 100644 --- a/core/src/main/res/values-bg-rBG/strings.xml +++ b/core/src/main/res/values-bg-rBG/strings.xml @@ -80,7 +80,6 @@ Удължен болус Актуализирано време на помпата Изход - Сериен номер Премахни APS е изключен Аларма @@ -290,6 +289,7 @@ СПРИ БОЛУС Източник Действие + %1$d час %1$d часа diff --git a/core/src/main/res/values-ca-rES/strings.xml b/core/src/main/res/values-ca-rES/strings.xml index 6fcff51e89..1a5baa3b01 100644 --- a/core/src/main/res/values-ca-rES/strings.xml +++ b/core/src/main/res/values-ca-rES/strings.xml @@ -56,4 +56,5 @@ + diff --git a/core/src/main/res/values-cs-rCZ/strings.xml b/core/src/main/res/values-cs-rCZ/strings.xml index 1fb65bf365..225b6b206a 100644 --- a/core/src/main/res/values-cs-rCZ/strings.xml +++ b/core/src/main/res/values-cs-rCZ/strings.xml @@ -81,7 +81,6 @@ Prodloužený bolus Čas v pumpě aktualizován Konec - Sériové číslo Odstranit záznam Smyčka je zakázána Alarm @@ -385,6 +384,21 @@ SMYČKA ZMĚNĚNA SMYČKA ODEBRÁNA JINÉ + + Dolní cíl profilu + Horní cíl profilu + Dolní hodnota dočasného cíle + Horní hodnota dočasného cíle + Hodnota dočasného cíle + Hodnota DIA profilu + Hodnota citlivosti profilu + Maximální hodnota profilu bazálu + Aktuální hodnota bazálu + Inzulino-sacharidový poměr profilu + %1$.2f omezeno na %2$.2f + »%1$s« je mimo pevně nastavené limity + »%1$s« %2$.2f je mimo pevně nastavené limity + Hodnota bazálu %1$d den %1$d dnů diff --git a/core/src/main/res/values-da-rDK/strings.xml b/core/src/main/res/values-da-rDK/strings.xml index 253defae86..94b2e3b8e7 100644 --- a/core/src/main/res/values-da-rDK/strings.xml +++ b/core/src/main/res/values-da-rDK/strings.xml @@ -72,4 +72,5 @@ + diff --git a/core/src/main/res/values-de-rDE/strings.xml b/core/src/main/res/values-de-rDE/strings.xml index 55dd2152b5..1ad829543c 100644 --- a/core/src/main/res/values-de-rDE/strings.xml +++ b/core/src/main/res/values-de-rDE/strings.xml @@ -81,7 +81,6 @@ Verzögerter Bolus Pumpenzeit aktualisiert Verlassen - Seriennummer Eintrag löschen Loop ist deaktiviert. Alarm @@ -349,6 +348,19 @@ Aktion Zeitstempel Keine Einheit + + Profil unteres Ziel + Profil oberes Ziel + Temp. Ziel unterer Wert + Temp. Ziel oberer Wert + Temp. Ziel Wert + Profil Insulinwirkdauer + Profil Sensitivitätswert + Profil max. Basalwert + Aktueller Basalwert + Profil KH-Faktor + %1$.2f limitiert auf %2$.2f + »%1$s« ist außerhalb der fest programmierten Grenzen %1$d Tag %1$d Tage diff --git a/core/src/main/res/values-el-rGR/strings.xml b/core/src/main/res/values-el-rGR/strings.xml index 02531e039c..7d302b70f2 100644 --- a/core/src/main/res/values-el-rGR/strings.xml +++ b/core/src/main/res/values-el-rGR/strings.xml @@ -59,4 +59,5 @@ + diff --git a/core/src/main/res/values-es-rES/strings.xml b/core/src/main/res/values-es-rES/strings.xml index 6c95ec7a74..abacc66600 100644 --- a/core/src/main/res/values-es-rES/strings.xml +++ b/core/src/main/res/values-es-rES/strings.xml @@ -253,6 +253,7 @@ Por favor reinicia el teléfono o AndroidAPS desde ajustes de sistema, sino AndroidAPS no guardará registros (importante para trazar y verificar que el algoritmo funcione correctamente)! + %1$d día %1$d días diff --git a/core/src/main/res/values-fr-rFR/strings.xml b/core/src/main/res/values-fr-rFR/strings.xml index dca16eb3a9..06efb1d051 100644 --- a/core/src/main/res/values-fr-rFR/strings.xml +++ b/core/src/main/res/values-fr-rFR/strings.xml @@ -81,7 +81,6 @@ Bolus étendu Mise à jour de l\'heure de la pompe Quitter - Numéro de série Supprimer l\'enregistrement La Boucle est désactivée Alarme @@ -385,6 +384,7 @@ BOUCLE CHANGÉE BOUCLE SUPPRIMÉE AUTRE + %1$d jour %1$d jours diff --git a/core/src/main/res/values-ga-rIE/strings.xml b/core/src/main/res/values-ga-rIE/strings.xml index 371108af05..ee54ad0c0e 100644 --- a/core/src/main/res/values-ga-rIE/strings.xml +++ b/core/src/main/res/values-ga-rIE/strings.xml @@ -131,4 +131,5 @@ + diff --git a/core/src/main/res/values-hr-rHR/strings.xml b/core/src/main/res/values-hr-rHR/strings.xml index e81d449be1..0a9e749b51 100644 --- a/core/src/main/res/values-hr-rHR/strings.xml +++ b/core/src/main/res/values-hr-rHR/strings.xml @@ -25,4 +25,5 @@ + diff --git a/core/src/main/res/values-it-rIT/strings.xml b/core/src/main/res/values-it-rIT/strings.xml index f769ae42f9..8ee67e1382 100644 --- a/core/src/main/res/values-it-rIT/strings.xml +++ b/core/src/main/res/values-it-rIT/strings.xml @@ -81,7 +81,6 @@ Bolo esteso Ora del micro aggiornata Esci - Numero seriale Rimuovi record Il loop è disabilitato Allarme @@ -385,6 +384,21 @@ LOOP CAMBIATO LOOP RIMOSSO ALTRO + + Target basso (profilo) + Target alto (profilo) + Valore inferiore target temporaneo + Valore superiore target temporaneo + Valore target temporaneo + Valore DIA (profilo) + Valore sensibilità (profilo) + Valore max basale (profilo) + Valore basale corrente + Valore rapporto CHO (profilo) + %1$.2f limitato a %2$.2f + »%1$s« è fuori dai limiti consentiti + »%1$s« %2$.2f è fuori dai limiti consentiti + Valore basale %1$d giorno %1$d giorni diff --git a/core/src/main/res/values-iw-rIL/strings.xml b/core/src/main/res/values-iw-rIL/strings.xml index 3159c19f7a..34c0d220b3 100644 --- a/core/src/main/res/values-iw-rIL/strings.xml +++ b/core/src/main/res/values-iw-rIL/strings.xml @@ -81,7 +81,6 @@ בולוס ממושך שעון המשאבה עודכן יציאה - מספר סידורי מחיקת רשומה הלולאה מושבתת התראה @@ -385,6 +384,21 @@ הלולאה שונתה הלולאה הוסרה אחר + + ערך המטרה הנמוך של הפרופיל + ערך המטרה הגבוה של הפרופיל + ערך תחתון של המטרה הזמנית + ערך עליון של המטרה הזמנית + ערך המטרה הזמני + ערך DIA של הפרופיל + ערך הרגישות של הפרופיל + מינון בזאלי מרבי של הפרופיל + מינון בזאלי נוכחי + יחס הפחמימות של הפרופיל + %1$.2f מוגבל ל- %2$.2f + »הערך %1$s« מחוץ לתחום הקשיח + »הערך %1$s« %2$.2f מחוץ לתחום הקשיח + ערך בזאלי %1$d יום %1$d ימים diff --git a/core/src/main/res/values-ko-rKR/strings.xml b/core/src/main/res/values-ko-rKR/strings.xml index 4b71c404f8..38e95bbb57 100644 --- a/core/src/main/res/values-ko-rKR/strings.xml +++ b/core/src/main/res/values-ko-rKR/strings.xml @@ -75,7 +75,6 @@ 확장 Bolus 펌프 시간 업데이트 종료 - 시리얼번호 기록 삭제 Loop가 중지중입니다. 알람 @@ -236,6 +235,7 @@ 실행 + %1$d 일 diff --git a/core/src/main/res/values-lt-rLT/strings.xml b/core/src/main/res/values-lt-rLT/strings.xml index 8707183adc..e22a9abecd 100644 --- a/core/src/main/res/values-lt-rLT/strings.xml +++ b/core/src/main/res/values-lt-rLT/strings.xml @@ -267,6 +267,7 @@ Š S + %1$d d. %1$d d. diff --git a/core/src/main/res/values-nl-rNL/strings.xml b/core/src/main/res/values-nl-rNL/strings.xml index c84f931ff6..289793a18c 100644 --- a/core/src/main/res/values-nl-rNL/strings.xml +++ b/core/src/main/res/values-nl-rNL/strings.xml @@ -238,6 +238,7 @@ Herstart je telefoon of herstart AndroidAPS vanuit de systeem instellingen. \nAnders zullen er voor AndroidAPS geen logs worden aangemaakt (dit is belangrijk voor de ontwikkelaars, zo kunnen zij controleren of de algoritmes correct werken)! + %1$d dag %1$d dagen diff --git a/core/src/main/res/values-no-rNO/strings.xml b/core/src/main/res/values-no-rNO/strings.xml index 5dc889cffd..69d7f3835e 100644 --- a/core/src/main/res/values-no-rNO/strings.xml +++ b/core/src/main/res/values-no-rNO/strings.xml @@ -81,7 +81,6 @@ Forlenget bolus Pumpens tid er oppdatert Avslutt - Serienummer Fjern registrering Loop er deaktivert Alarm @@ -385,6 +384,7 @@ LOOP ENDRET LOOP FJERNET ANNET + %1$d dag %1$d dager diff --git a/core/src/main/res/values-pl-rPL/strings.xml b/core/src/main/res/values-pl-rPL/strings.xml index 7ee0250ffc..ca320d647b 100644 --- a/core/src/main/res/values-pl-rPL/strings.xml +++ b/core/src/main/res/values-pl-rPL/strings.xml @@ -261,4 +261,5 @@ + diff --git a/core/src/main/res/values-pt-rBR/strings.xml b/core/src/main/res/values-pt-rBR/strings.xml index 852d393422..06f743e9c2 100644 --- a/core/src/main/res/values-pt-rBR/strings.xml +++ b/core/src/main/res/values-pt-rBR/strings.xml @@ -236,4 +236,5 @@ + diff --git a/core/src/main/res/values-pt-rPT/strings.xml b/core/src/main/res/values-pt-rPT/strings.xml index 52da47ab32..c3ef38543e 100644 --- a/core/src/main/res/values-pt-rPT/strings.xml +++ b/core/src/main/res/values-pt-rPT/strings.xml @@ -81,7 +81,6 @@ Bólus Prolongado Hora da bomba actualizada Sair - Número de Série Remover registo Loop está desactivado Alarme @@ -353,6 +352,7 @@ EXPORTAR ENTRADAS DO UTILIZADOR DESCONHECIDO Exportar Entradas do Utilizador para o Excel (csv) + %1$d dia %1$d dias diff --git a/core/src/main/res/values-ro-rRO/strings.xml b/core/src/main/res/values-ro-rRO/strings.xml index a7c0435732..5f887266f2 100644 --- a/core/src/main/res/values-ro-rRO/strings.xml +++ b/core/src/main/res/values-ro-rRO/strings.xml @@ -79,7 +79,6 @@ Bolus extins Timpul din pompă a fost actualizat Ieșire - Număr serial Șterge înregistrarea Bucla este dezactivată Alarmă @@ -284,6 +283,7 @@ S D + %1$d zi %1$d zile diff --git a/core/src/main/res/values-ru-rRU/strings.xml b/core/src/main/res/values-ru-rRU/strings.xml index d823f05065..0e32949ffc 100644 --- a/core/src/main/res/values-ru-rRU/strings.xml +++ b/core/src/main/res/values-ru-rRU/strings.xml @@ -81,7 +81,6 @@ Пролонгированный болюс Время на помпе обновлено Выйти - Серийный номер Удалить запись Зцикл не работает Оповещения об опасности @@ -385,6 +384,21 @@ КОНТУР ИЗМЕНЕН КОНТУР УДАЛЕН ДРУГОЕ + + Нижнее целевое значение профиля + Верхнее целевое значение профиля + Нижнее значение временного целевого уровня + Верхнее значение временного целевого уровня + Временное целевое значение + Значение длительности действия инсулина DIA в профиле + Значение чувствительности в профиле + Максимальное значение базала в профиле + Текущее значение базала + Коэффициент углеводов в профиле + %1$.2f ограничено до %2$.2f + »%1$s« за пределами жестких ограничений + »%1$s« %2$.2f за пределами жестких ограничений + Величина базала %1$d день %1$d дня diff --git a/core/src/main/res/values-sk-rSK/strings.xml b/core/src/main/res/values-sk-rSK/strings.xml index aaf22657af..02bf0993a0 100644 --- a/core/src/main/res/values-sk-rSK/strings.xml +++ b/core/src/main/res/values-sk-rSK/strings.xml @@ -81,7 +81,6 @@ Predĺžený bolus Čas v pumpe bol aktualizovaný Koniec - Sériové číslo Odstrániť záznam Uzavretý okruh je deaktivovaný Alarm @@ -385,6 +384,7 @@ UZAVRETÝ OKRUH ZMENENÝ UZAVRETÝ OKRUH ODSTRÁNENÝ INÉ + %1$d deň %1$d dní diff --git a/core/src/main/res/values-sl-rSI/strings.xml b/core/src/main/res/values-sl-rSI/strings.xml index e81d449be1..0a9e749b51 100644 --- a/core/src/main/res/values-sl-rSI/strings.xml +++ b/core/src/main/res/values-sl-rSI/strings.xml @@ -25,4 +25,5 @@ + diff --git a/core/src/main/res/values-sv-rSE/strings.xml b/core/src/main/res/values-sv-rSE/strings.xml index 0bb588fbc1..4c9a90f99a 100644 --- a/core/src/main/res/values-sv-rSE/strings.xml +++ b/core/src/main/res/values-sv-rSE/strings.xml @@ -262,4 +262,5 @@ + diff --git a/core/src/main/res/values-ta-rIN/strings.xml b/core/src/main/res/values-ta-rIN/strings.xml index e81d449be1..0a9e749b51 100644 --- a/core/src/main/res/values-ta-rIN/strings.xml +++ b/core/src/main/res/values-ta-rIN/strings.xml @@ -25,4 +25,5 @@ + diff --git a/core/src/main/res/values-tr-rTR/strings.xml b/core/src/main/res/values-tr-rTR/strings.xml index 733b98f8dd..7a4d5e1725 100644 --- a/core/src/main/res/values-tr-rTR/strings.xml +++ b/core/src/main/res/values-tr-rTR/strings.xml @@ -11,7 +11,6 @@ güvenli olmayan kullanım Pompa ulaşılamıyor Pompa zamanı güncellendi - Seri numarası Döngü devre dışı bırak Döngü etkinleştir Döngüyü başlat @@ -48,4 +47,5 @@ + diff --git a/core/src/main/res/values-zh-rCN/strings.xml b/core/src/main/res/values-zh-rCN/strings.xml index 2df76bcb7d..2b6f47d568 100644 --- a/core/src/main/res/values-zh-rCN/strings.xml +++ b/core/src/main/res/values-zh-rCN/strings.xml @@ -90,4 +90,5 @@ + diff --git a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 378a931a9f..bd213d3c8e 100644 --- a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -17,10 +17,8 @@ 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: ActivePlugin diff --git a/core/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt b/core/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt index 8259d37968..b702ea05bd 100644 --- a/core/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/data/ConstraintTest.kt @@ -2,19 +2,13 @@ package info.nightscout.androidaps.data import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner /** * Created by mike on 19.03.2018. */ -@RunWith(PowerMockRunner::class) -@PrepareForTest(SP::class) class ConstraintTest : TestBase() { @Test fun doTests() { diff --git a/core/src/test/java/info/nightscout/androidaps/data/IobTest.kt b/core/src/test/java/info/nightscout/androidaps/data/IobTest.kt index 7a550b03f6..b941a8014f 100644 --- a/core/src/test/java/info/nightscout/androidaps/data/IobTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/data/IobTest.kt @@ -2,10 +2,7 @@ package info.nightscout.androidaps.data import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class IobTest { @Test fun plusTest() { diff --git a/core/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt b/core/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt index bfe97bc80a..c9c30b296a 100644 --- a/core/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/data/IobTotalTest.kt @@ -1,17 +1,15 @@ package info.nightscout.androidaps.data import android.content.Context +import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.utils.DateUtil import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner @Suppress("SpellCheckingInspection") -@RunWith(PowerMockRunner::class) -class IobTotalTest { +class IobTotalTest : TestBase() { @Mock lateinit var context: Context diff --git a/core/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt b/core/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt index 07ecaffe97..4dd36c1f99 100644 --- a/core/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/data/MealDataTest.kt @@ -2,10 +2,7 @@ package info.nightscout.androidaps.data import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MealDataTest { @Test fun canCreateObject() { diff --git a/core/src/test/java/info/nightscout/androidaps/data/PumpEnactResultTest.kt b/core/src/test/java/info/nightscout/androidaps/data/PumpEnactResultTest.kt index ed9c772189..687c9a64e8 100644 --- a/core/src/test/java/info/nightscout/androidaps/data/PumpEnactResultTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/data/PumpEnactResultTest.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.data -import android.text.Html import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBaseWithProfile @@ -9,14 +8,9 @@ import org.json.JSONObject import org.junit.Assert import org.junit.Before 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 import org.skyscreamer.jsonassert.JSONAssert -@RunWith(PowerMockRunner::class) -@PrepareForTest(Html::class) class PumpEnactResultTest : TestBaseWithProfile() { val injector = HasAndroidInjector { diff --git a/core/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt b/core/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt index c288a064dc..59184335e5 100644 --- a/core/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/interfaces/PluginDescriptionTest.kt @@ -3,10 +3,7 @@ package info.nightscout.androidaps.interfaces import androidx.fragment.app.Fragment import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class PluginDescriptionTest { @Test fun mainTypeTest() { diff --git a/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt b/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt index aa3b7944b3..67d0c695f2 100644 --- a/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt @@ -14,15 +14,10 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class) class APSResultTest : TestBaseWithProfile() { @Mock lateinit var constraintChecker: ConstraintChecker diff --git a/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormatTest.kt b/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormatTest.kt index 0e79137e97..8ad8516c7d 100644 --- a/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormatTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormatTest.kt @@ -5,15 +5,10 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.io.File -@RunWith(PowerMockRunner::class) -@PrepareForTest(File::class, UserEntryPresentationHelper::class) class ClassicPrefsFormatTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper diff --git a/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt b/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt index dba07234bc..087cfcadc1 100644 --- a/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/formats/EncryptedPrefsFormatTest.kt @@ -9,19 +9,12 @@ import org.junit.Assert import org.junit.Assume import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito -import org.powermock.core.classloader.annotations.PowerMockIgnore -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.io.File @Suppress("SpellCheckingInspection") -@PowerMockIgnore("javax.crypto.*") -@RunWith(PowerMockRunner::class) -@PrepareForTest(File::class) class EncryptedPrefsFormatTest : TestBase() { @Mock lateinit var resourceHelper: ResourceHelper diff --git a/core/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt b/core/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt index 31319712a1..20975c9654 100644 --- a/core/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt @@ -12,20 +12,14 @@ import info.nightscout.androidaps.utils.T import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.api.mockito.PowerMockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.util.* /** * Created by mike on 26.03.2018. */ @Suppress("SpellCheckingInspection") -@RunWith(PowerMockRunner::class) -@PrepareForTest(DateUtil::class, AutosensDataStore::class) class GlucoseStatusTest : TestBase() { @Mock lateinit var dateUtil: DateUtil @@ -48,7 +42,7 @@ class GlucoseStatusTest : TestBase() { } @Test fun calculateValidGlucoseStatus() { - PowerMockito.`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateValidBgData()) + `when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateValidBgData()) val glucoseStatus = GlucoseStatusProvider(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!! Assert.assertEquals(214.0, glucoseStatus.glucose, 0.001) Assert.assertEquals(-2.0, glucoseStatus.delta, 0.001) @@ -58,7 +52,7 @@ class GlucoseStatusTest : TestBase() { } @Test fun calculateMostRecentGlucoseStatus() { - PowerMockito.`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateMostRecentBgData()) + `when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateMostRecentBgData()) val glucoseStatus: GlucoseStatus = GlucoseStatusProvider(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!! Assert.assertEquals(215.0, glucoseStatus.glucose, 0.001) // (214+216) / 2 Assert.assertEquals(-1.0, glucoseStatus.delta, 0.001) @@ -68,7 +62,7 @@ class GlucoseStatusTest : TestBase() { } @Test fun oneRecordShouldProduceZeroDeltas() { - PowerMockito.`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateOneCurrentRecordBgData()) + `when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateOneCurrentRecordBgData()) val glucoseStatus: GlucoseStatus = GlucoseStatusProvider(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!! Assert.assertEquals(214.0, glucoseStatus.glucose, 0.001) Assert.assertEquals(0.0, glucoseStatus.delta, 0.001) @@ -78,19 +72,19 @@ class GlucoseStatusTest : TestBase() { } @Test fun insufficientDataShouldReturnNull() { - PowerMockito.`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateInsufficientBgData()) + `when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateInsufficientBgData()) val glucoseStatus: GlucoseStatus? = GlucoseStatusProvider(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData Assert.assertEquals(null, glucoseStatus) } @Test fun oldDataShouldReturnNull() { - PowerMockito.`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateOldBgData()) + `when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateOldBgData()) val glucoseStatus: GlucoseStatus? = GlucoseStatusProvider(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData Assert.assertEquals(null, glucoseStatus) } @Test fun returnOldDataIfAllowed() { - PowerMockito.`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateOldBgData()) + `when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateOldBgData()) val glucoseStatus: GlucoseStatus? = GlucoseStatusProvider(aapsLogger, iobCobCalculatorPlugin, dateUtil).getGlucoseStatusData(true) Assert.assertNotEquals(null, glucoseStatus) } @@ -100,7 +94,7 @@ class GlucoseStatusTest : TestBase() { } @Test fun calculateGlucoseStatusForLibreTestBgData() { - PowerMockito.`when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateLibreTestData()) + `when`(autosensDataStore.getBgReadingsDataTableCopy()).thenReturn(generateLibreTestData()) val glucoseStatus: GlucoseStatus = GlucoseStatusProvider(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!! Assert.assertEquals(100.0, glucoseStatus.glucose, 0.001) // Assert.assertEquals(-10.0, glucoseStatus.delta, 0.001) diff --git a/core/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt b/core/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt index cadc892e82..974b088041 100644 --- a/core/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/utils/CryptoUtilTest.kt @@ -6,9 +6,6 @@ import org.hamcrest.CoreMatchers.not import org.junit.Assert import org.junit.Assume.assumeThat import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PowerMockIgnore -import org.powermock.modules.junit4.PowerMockRunner // 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 @@ -21,8 +18,6 @@ fun assumeAES256isSupported(cryptoUtil: CryptoUtil) { } @Suppress("SpellCheckingInspection") -@PowerMockIgnore("javax.crypto.*") -@RunWith(PowerMockRunner::class) class CryptoUtilTest : TestBase() { private var cryptoUtil: CryptoUtil = CryptoUtil(aapsLogger) diff --git a/core/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt b/core/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt index 57119d66bd..2df42bf26c 100644 --- a/core/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/utils/DateUtilTest.kt @@ -6,13 +6,10 @@ import info.nightscout.androidaps.core.R import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner import java.util.* -@RunWith(PowerMockRunner::class) class DateUtilTest : TestBase() { @Mock lateinit var context: Context diff --git a/core/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt b/core/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt index 35049e7fb8..4fee86273b 100644 --- a/core/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/utils/DecimalFormatterTest.kt @@ -2,10 +2,7 @@ package info.nightscout.androidaps.utils import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DecimalFormatterTest { @Test fun to0DecimalTest() { diff --git a/core/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt b/core/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt index c2863ff4a3..fbbd78f525 100644 --- a/core/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt +++ b/core/src/test/java/info/nightscout/androidaps/utils/JsonHelperTest.kt @@ -3,11 +3,8 @@ package info.nightscout.androidaps.utils import org.json.JSONObject import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner @Suppress("SpellCheckingInspection") -@RunWith(PowerMockRunner::class) class JsonHelperTest { private val jsonString = "{\"d\":\"3.0\",\"i\":\"4\",\"s\":\"5\",\"b\":\"true\",\"j\":{\"a\": \"1\"}}" diff --git a/dana/build.gradle b/dana/build.gradle index 46e26b9616..2f86ece0a2 100644 --- a/dana/build.gradle +++ b/dana/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 902fbb0df5..bd213d3c8e 100644 --- a/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,11 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.extensions.pureProfileFromJson -import info.nightscout.androidaps.interfaces.* +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.Config +import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ProfileStore import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DefaultValueHelper @@ -13,10 +17,8 @@ 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: ActivePlugin diff --git a/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt b/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt index fe5e5e61df..290c626fac 100644 --- a/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt +++ b/dana/src/test/java/info/nightscout/androidaps/dana/DanaPumpTest.kt @@ -5,11 +5,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaPumpTest : TestBaseWithProfile() { @Mock lateinit var sp: SP diff --git a/danar/build.gradle b/danar/build.gradle index 230038a50c..1e7087736e 100644 --- a/danar/build.gradle +++ b/danar/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 902fbb0df5..bd213d3c8e 100644 --- a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,11 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.extensions.pureProfileFromJson -import info.nightscout.androidaps.interfaces.* +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.Config +import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ProfileStore import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DefaultValueHelper @@ -13,10 +17,8 @@ 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: ActivePlugin diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index 6bbadd14e9..395716449f 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -17,14 +17,9 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(SP::class, ConstraintChecker::class) class DanaRPluginTest : TestBaseWithProfile() { @Mock lateinit var context: Context diff --git a/danar/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 index 5b24a3b8b7..e2847894bb 100644 --- a/danar/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 @@ -27,9 +27,7 @@ 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, DanaRKoreanPlugin::class, DanaRPlugin::class) open class DanaRTestBase : TestBase() { @Mock lateinit var sp: SP diff --git a/danar/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 index 3c382e7a8e..1a080a0d10 100644 --- a/danar/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 @@ -4,11 +4,8 @@ import info.nightscout.androidaps.danar.comm.MessageHashTableR import info.nightscout.androidaps.interfaces.Constraint import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MessageHashTableRTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index a7c470008b..02c197f625 100644 --- a/danar/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 @@ -5,12 +5,9 @@ import info.nightscout.androidaps.danar.comm.MsgBolusProgress import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgBolusProgressTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index ce02b1fe6f..2b00d74b25 100644 --- a/danar/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 @@ -2,16 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgBolusStart import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker 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) class MsgBolusStartTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 6048350c87..0421e408b9 100644 --- a/danar/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 @@ -2,16 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker 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) class MsgBolusStartWithSpeedTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 46b901ec60..76390f7404 100644 --- a/danar/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 @@ -5,11 +5,8 @@ import info.nightscout.androidaps.danar.comm.MsgBolusStop import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mockito.`when` -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgBolusStopTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index be0165938f..f44be2f968 100644 --- a/danar/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 @@ -4,10 +4,7 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.comm.MsgCheckValue import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgCheckValueTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 39798547c4..ec678cda21 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgErrorTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 400320eba5..baac96b341 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryAlarmTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 0e45e40cc6..9177446e61 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryAllDoneTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 4d61b03288..a10127dd38 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryAllTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 67cf3ebcc2..4d53cff893 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryBasalHourTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index b1748562ce..0e43c3fd94 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryBolus import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryBolusTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 1bf3cf77a6..61e543b1e2 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryCarboTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index dd2274f669..a860b309c3 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryDailyInsulinTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 320e34529d..cb7c30f9fc 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryDone import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryDoneTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 1f0babb908..dd1ec5f59a 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryError import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryErrorTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 113c11dddd..e3a3ad3ddb 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryGlucoseTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 321bd0f036..5c8c4da006 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryNewDone import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryNewDoneTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 5144a672a1..1bc690ffdf 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryNew import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryNewTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index f4162adfb3..a8fa3704c0 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistoryRefill import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistoryRefillTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 59f8d6a181..b3b5774cd9 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgHistorySuspend import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgHistorySuspendTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index dac1589cac..cc6a16da3f 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgInitConnStatusBasicTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 96c3ead153..2171701f7d 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgInitConnStatusBolusTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 33ab2005dc..2ce904bfa4 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgInitConnStatusOptionTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 9a850c7cd5..b518d8ae92 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgInitConnStatusTimeTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 426086e1b7..9f51769c58 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgPCCommStart import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgPCCommStartTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 75b60f6686..ef1f6555c2 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgPCCommStop import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgPCCommStopTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index bafa3b3376..30835645f2 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetActivateBasalProfileTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 56c2c51d0e..be82e6eb37 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetBasalProfileTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 9a0ba905ee..9b508b0514 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetCarbsEntryTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 967fed825b..8d0ff919d7 100644 --- a/danar/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 @@ -2,16 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart import info.nightscout.androidaps.interfaces.Constraint -import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker 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) class MsgSetExtendedBolusStartTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index dfac8cbfd3..af3b58f2ea 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetExtendedBolusStopTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 79e43acd7e..b959f2b9f9 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetSingleBasalProfileTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 715a491779..8d532863c6 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetTempBasalStartTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 44a1c64ddb..088469ab64 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetTimeTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 14c70f4a04..fe325d8aa3 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetUserOptionsTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 532d6e0c7b..b19085f7f3 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingActiveProfileTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index cf172d5f50..746a0b197f 100644 --- a/danar/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 @@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.danar.comm.MsgSettingBasalProfileAll import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingBasalProfileAllTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 4915e79dec..b4380177cb 100644 --- a/danar/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 @@ -4,13 +4,8 @@ import info.nightscout.androidaps.danar.comm.MsgSettingBasal import info.nightscout.androidaps.interfaces.PumpDescription 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(info.nightscout.androidaps.danar.DanaRPlugin::class) class MsgSettingBasalTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 5a779d70b6..7939e5a26b 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingGlucoseTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 95152aed97..206e578bea 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingMaxValuesTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 1c7126485b..ac21cfe082 100644 --- a/danar/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 @@ -1,16 +1,9 @@ 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.MsgSettingMeal 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(DanaRPlugin::class, DanaRKoreanPlugin::class) class MsgSettingMealTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index d04e4dcfcb..fb0a54b21f 100644 --- a/danar/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 @@ -4,10 +4,7 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingProfileRatiosAllTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 2cc012862c..7bffd88b0c 100644 --- a/danar/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 @@ -4,10 +4,7 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingProfileRatiosTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 4bed4e080e..6c8358e203 100644 --- a/danar/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 @@ -5,10 +5,7 @@ import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime import org.joda.time.DateTime import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingPumpTimeTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index f75ed71ba7..ae55b85b15 100644 --- a/danar/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 @@ -5,10 +5,7 @@ import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingShippingInfoTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index c9c300081d..518814623e 100644 --- a/danar/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 @@ -4,10 +4,7 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSettingUserOptionsTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index 910e84830f..939eb466f7 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgStatusBasicTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index fb2687ff6a..9f2390dc56 100644 --- a/danar/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 @@ -4,10 +4,7 @@ import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended import info.nightscout.androidaps.utils.T import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgStatusBolusExtendedTest : DanaRTestBase() { @Test diff --git a/danar/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 index 3872536d6e..2e467936f9 100644 --- a/danar/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 @@ -4,10 +4,7 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danar.comm.MsgStatusProfile import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgStatusProfileTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index f2a63b72ac..06cd1c5863 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgStatusTempBasalTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/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 index ad8ef6a2d1..f8161b507d 100644 --- a/danar/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 @@ -3,10 +3,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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgStatusTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index e1762ddc6d..b118854394 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -17,14 +17,9 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(SP::class, ConstraintChecker::class) class DanaRKoreanPluginTest : TestBaseWithProfile() { @Mock lateinit var context: Context diff --git a/danar/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 index 2b8bcc6ae1..3d23027a0e 100644 --- a/danar/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 @@ -5,11 +5,8 @@ import info.nightscout.androidaps.interfaces.Constraint 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.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MessageHashTableRKoreanTest : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index bbdaececa1..674b82943d 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -18,14 +18,9 @@ import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalSt import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock 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, TemporaryBasalStorage::class) class DanaRv2PluginTest : TestBaseWithProfile() { @Mock lateinit var context: Context diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt index 328b698dd8..8fc5853a0c 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt @@ -7,11 +7,8 @@ import info.nightscout.androidaps.interfaces.Constraint 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.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MessageHashTableRv2Test : DanaRTestBase() { @Test diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt index 9a85644f8a..2b8abf85b7 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValueRv2Test.kt @@ -5,10 +5,7 @@ import info.nightscout.androidaps.danaRv2.comm.MsgCheckValue_v2 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.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgCheckValueRv2Test : DanaRTestBase() { @Test diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt index e76e29fa6e..90f0def7df 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEventsRv2Test.kt @@ -1,19 +1,13 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.danaRv2.comm.MsgHistoryEvents_v2 -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.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(DetailedBolusInfoStorage::class) class MsgHistoryEventsRv2Test : DanaRTestBase() { - @Test @Throws(Exception::class) fun runTest() { + @Test fun runTest() { val packet = MsgHistoryEvents_v2(injector, 0) // test message decoding diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt index 53a52638a7..d55fb9ddb5 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStartRv2Test.kt @@ -4,10 +4,7 @@ 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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetAPSTempBasalStartRv2Test : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt index acc24a0fea..5f33449601 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntryRv2Test.kt @@ -4,10 +4,7 @@ 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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgSetHistoryEntryRv2Test : DanaRTestBase() { @Test fun runTest() { diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt index ed0d4edb65..ce8c4bf93e 100644 --- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt +++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPSRv2Test.kt @@ -4,10 +4,7 @@ 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.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class MsgStatusAPSRv2Test : DanaRTestBase() { @Test diff --git a/danars/build.gradle b/danars/build.gradle index a013ae98af..a754c4b87e 100644 --- a/danars/build.gradle +++ b/danars/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index 902fbb0df5..bd213d3c8e 100644 --- a/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,11 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.extensions.pureProfileFromJson -import info.nightscout.androidaps.interfaces.* +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.Config +import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ProfileStore import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DefaultValueHelper @@ -13,10 +17,8 @@ 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: ActivePlugin diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt index 61f2ea5d53..45fcde6f93 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/DanaRSPluginTest.kt @@ -7,23 +7,17 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.eq import org.mockito.Mock import org.mockito.Mockito -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner @Suppress("SpellCheckingInspection") -@RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, RxBusWrapper::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class) class DanaRSPluginTest : DanaRSTestBase() { @Mock lateinit var context: Context diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt index 47f894bc6d..66adc8ed69 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketBasalSetTemporaryBasalTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRSPacketBasalSetTemporaryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt index d3307c9d2a..a75b665882 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketHistoryAlarmTest.kt @@ -7,12 +7,9 @@ import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner import java.util.* -@RunWith(PowerMockRunner::class) class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() { @Mock lateinit var danaHistoryRecordDao: DanaHistoryRecordDao diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt index 5d30bd101b..034df8113e 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt @@ -2,23 +2,16 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.`when` import org.mockito.Mockito.anyDouble import org.mockito.Mockito.anyInt -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class, DanaRSPlugin::class) class DanaRSPacketNotifyDeliveryCompleteTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePlugin diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt index 101c8e8750..d5b2cdd15e 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketOptionSetUserOptionTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRSPacketOptionSetUserOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt index 1fa4f4c7ee..62244b0ba2 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsMessageHashTableTest.kt @@ -11,19 +11,13 @@ 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.Mock 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) class DanaRsMessageHashTableTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var constraintChecker: ConstraintChecker - @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt index 8386456660..5b44730191 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsBasalSetTemporaryBasalTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketApsBasalSetTemporaryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt index 2a473adec7..de5f2d7588 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsHistoryEventsTest.kt @@ -3,23 +3,16 @@ package info.nightscout.androidaps.danars.comm import android.content.Context import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner import java.util.* -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class, DanaRSPlugin::class) class DanaRsPacketApsHistoryEventsTest : DanaRSTestBase() { @Mock lateinit var context: Context diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt index 9c686a0cc6..584e6da3bb 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketApsSetEventHistoryTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketApsSetEventHistoryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt index 8e8df0b82c..f7865fce36 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetBasalRateTest.kt @@ -2,16 +2,10 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class) class DanaRsPacketBasalGetBasalRateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt index 0b2d34b2bc..7af25076a8 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalGetProfileNumberTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBasalGetProfileNumberTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt index 1f62adaf8a..febbbe50eb 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetCancelTemporaryBasalTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBasalSetCancelTemporaryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt index a0d67b3212..95f75223bd 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileBasalRateTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBasalSetProfileBasalRateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt index 45137998b8..814af18eab 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetProfileNumberTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBasalSetProfileNumberTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt index 4e956beabf..f177c68414 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOffTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBasalSetSuspendOffTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt index af501c62d1..5fa84275c2 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBasalSetSuspendOnTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBasalSetSuspendOnTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt index 369ab8fb3f..76dec68c50 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetBolusOptionTest.kt @@ -2,16 +2,10 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class) class DanaRsPacketBolusGetBolusOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt index ce75f1f60d..3705d0d389 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCalculationInformationTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBolusGetCalculationInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt index 49ef077121..4c9cd8754e 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetCirCfArrayTest.kt @@ -6,10 +6,7 @@ import info.nightscout.androidaps.dana.DanaPump import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBolusGetCirCfArrayTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt index 3af2adbc60..a244998923 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusGetStepBolusInformationTest.kt @@ -5,11 +5,8 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner import java.util.* -@RunWith(PowerMockRunner::class) class DanaRsPacketBolusGetStepBolusInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt index 1086d4eba2..703ff208bd 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetBolusOptionTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBolusSetBolusOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt index 67832e9ef1..1b6e49d08e 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusCancelTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBolusSetExtendedBolusCancelTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt index 2bb83c2395..28f60b33be 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetExtendedBolusTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketBolusSetExtendedBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt index a8d70ec52f..c1a9ea46b5 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStartTest.kt @@ -14,14 +14,9 @@ import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalSt import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock 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, TemporaryBasalStorage::class) class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() { @Mock lateinit var constraintChecker: ConstraintChecker diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt index cb5f396ecd..9ef433e555 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt @@ -2,22 +2,15 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class, DanaRSPlugin::class) class DanaRsPacketBolusSetStepBolusStopTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePlugin diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt index d4f49b7392..972344d5be 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcKeepConnectionTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketEtcKeepConnectionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt index 509f484180..4daf32e231 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketEtcSetHistorySaveTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketEtcSetHistorySaveTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt index 40a0d0bad4..a3ba829cb9 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetPumpCheckTest.kt @@ -3,15 +3,9 @@ package info.nightscout.androidaps.danars.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(RxBusWrapper::class) class DanaRsPacketGeneralGetPumpCheckTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt index 299fa6c8fb..2da38b4410 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingInformationTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketGeneralGetShippingInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt index f09dbaa108..1d2ba4af37 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetShippingVerisonTest.kt @@ -5,11 +5,8 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -class DanaRsPacketGeneralGetShippingVerisonTest : DanaRSTestBase() { +class DanaRsPacketGeneralGetShippingVersionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { AndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt index 09c68d6a6e..996bdc8b5b 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralGetUserTimeChangeFlagTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketGeneralGetUserTimeChangeFlagTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt index 14d6efad46..e402a7fa8f 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralInitialScreenInformationTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketGeneralInitialScreenInformationTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt index c179f63c0d..18a8ae0db9 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetHistoryUploadModeTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketGeneralSetHistoryUploadModeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt index d29722bf71..2a99d997f2 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketGeneralSetUserTimeChangeFlagClearTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketGeneralSetUserTimeChangeFlagClearTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt index 62e2f42646..036d58b32d 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryAllHistoryTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryAllHistoryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt index bfda87308b..91714c3855 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBasalTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryBasalTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt index 88245a085a..f37f3b80ee 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBloodGlucoseTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryBloodGlucoseTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt index aa642a645e..e571ab62d4 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryBolusTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryBolusTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt index cb77a3078b..5054c7bf04 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryCarbohydrateTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryCarbohydrateTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt index eb1c1331ec..8179ed8b8d 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryDailyTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryDailyTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt index bd050f9048..1658519465 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryPrimeTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryPrimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt index 8a961122d0..ebb1787050 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryRefillTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryRefillTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt index af5b2adcbd..bcdfc7e85c 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistorySuspendTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistorySuspendTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt index 5a906984a1..ff2836e7ec 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketHistoryTemporaryTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketHistoryTemporaryTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt index 3e2b68a21c..371cbb6811 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyAlarmTest.kt @@ -6,11 +6,8 @@ import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.PumpSync import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketNotifyAlarmTest : DanaRSTestBase() { @Mock lateinit var pumpSync: PumpSync diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index ef51dafae2..2bb10b963c 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -8,7 +8,6 @@ import info.nightscout.androidaps.danars.DanaRSTestBase import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.PumpSync -import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage @@ -16,15 +15,10 @@ import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalSt import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito.`when` -import org.powermock.core.classloader.annotations.PrepareForTest -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) -@PrepareForTest(ConstraintChecker::class, RxBusWrapper::class, DetailedBolusInfoStorage::class, TemporaryBasalStorage::class) class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePlugin diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt index 4062e844f8..dd74cf4962 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyMissedBolusAlarmTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketNotifyMissedBolusAlarmTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt index d2f8a624f3..f4297dc7d2 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetPumpTimeTest.kt @@ -6,10 +6,7 @@ import info.nightscout.androidaps.danars.DanaRSTestBase import org.joda.time.DateTime import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketOptionGetPumpTimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt index 7592981130..dfadad5108 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionGetUserOptionTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketOptionGetUserOptionTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt index 1bcf69767b..0cedf8b8c5 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketOptionSetPumpTimeTest.kt @@ -6,10 +6,7 @@ import info.nightscout.androidaps.danars.DanaRSTestBase import org.joda.time.DateTime import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketOptionSetPumpTimeTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt index 99688376d5..1e75515225 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewBolusAvgTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketReviewBolusAvgTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt index 44deb23fbd..beb0cb7256 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketReviewGetPumpDecRatioTest.kt @@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSTestBase import org.junit.Assert import org.junit.Test -import org.junit.runner.RunWith -import org.powermock.modules.junit4.PowerMockRunner -@RunWith(PowerMockRunner::class) class DanaRsPacketReviewGetPumpDecRatioTest : DanaRSTestBase() { private val packetInjector = HasAndroidInjector { diff --git a/database/build.gradle b/database/build.gradle index f570a3d484..af81fc73ac 100644 --- a/database/build.gradle +++ b/database/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" apply from: "${project.rootDir}/gradle/android_module_dependencies.gradle" @@ -39,3 +40,8 @@ dependencies { implementation "com.google.dagger:dagger-android-support:$dagger_version" api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" } + +allOpen { + // allows mocking for classes w/o directly opening them for release builds + annotation 'info.nightscout.androidaps.annotations.OpenForTesting' +} \ No newline at end of file diff --git a/core/src/debug/java/info/nightscout/androidaps/annotations/OpenForTesting.kt b/database/src/debug/java/info/nightscout/androidaps/annotations/OpenForTesting.kt similarity index 100% rename from core/src/debug/java/info/nightscout/androidaps/annotations/OpenForTesting.kt rename to database/src/debug/java/info/nightscout/androidaps/annotations/OpenForTesting.kt diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt index 458eff722e..eaab40563d 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.database +import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.database.data.NewEntries import info.nightscout.androidaps.database.entities.* import info.nightscout.androidaps.database.interfaces.DBEntry @@ -15,6 +16,7 @@ import javax.inject.Inject import javax.inject.Singleton import kotlin.math.roundToInt +@OpenForTesting @Singleton open class AppRepository @Inject internal constructor( internal val database: AppDatabase diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt index 00e9a3e25d..4b2b56d019 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt @@ -153,18 +153,20 @@ data class UserEntry( Objectives, //From Objectives plugin Pump, //To update with one Source per pump Dana, //Only one UserEntry in Common module Dana - DanaR, //No entry currently - DanaRC, //No entry currently - DanaRv2, //No entry currently - DanaRS, //No entry currently - Insight, //No entry currently - Combo, //No entry currently - Medtronic, //No entry currently + DanaR, + DanaRC, + DanaRv2, + DanaRS, + DanaI, + DiaconnG8, + Insight, + Combo, + Medtronic, Omnipod, //No entry currently - OmnipodEros, //No entry currently + OmnipodEros, OmnipodDash, //No entry currently - MDI, //No entry currently - VirtualPump, //No entry currently + MDI, + VirtualPump, SMS, //From SMS plugin Treatments, //From Treatments plugin Wear, //From Wear plugin diff --git a/core/src/release/java/info/nightscout/androidaps/annotations/OpenForTesting.kt b/database/src/release/java/info/nightscout/androidaps/annotations/OpenForTesting.kt similarity index 100% rename from core/src/release/java/info/nightscout/androidaps/annotations/OpenForTesting.kt rename to database/src/release/java/info/nightscout/androidaps/annotations/OpenForTesting.kt diff --git a/diaconn/build.gradle b/diaconn/build.gradle index 46e26b9616..2f86ece0a2 100644 --- a/diaconn/build.gradle +++ b/diaconn/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/diaconn/src/main/res/values-fr-rFR/strings.xml b/diaconn/src/main/res/values-fr-rFR/strings.xml index 576470b2e6..d289a19934 100644 --- a/diaconn/src/main/res/values-fr-rFR/strings.xml +++ b/diaconn/src/main/res/values-fr-rFR/strings.xml @@ -133,6 +133,7 @@ Recherche impossible en raison d\'une erreur CRC de paquets. Impossible de définir à cause d\'une erreur de paramètre d\'entrée. Impossible de définir à cause d\'une erreur de spécification de protocole. + Repas retardé, ne peut être injecté. Annulé par la pompe Autres actions en cours, limitation des paramètres de l\'application. Injection restreint pendant une autre injection de Bolus. @@ -140,6 +141,7 @@ Annulé à cause d\'absence de réponse de la pompe. L\'injection n\'est pas possible en raison d\'une pile faible. Injection impossible en raison de manque d\'insuline. + Vous ne pouvez pas l\'injecter car il dépasse la limite. L\'injection ne peut pas être effectuée car elle dépasse le volume d\'injection d\'aujourd\'hui. Une fois la configuration du basal terminée, l\'injection de basal peut être effectuée. Commande non transmise. Veuillez réessayer. diff --git a/diaconn/src/main/res/values-iw-rIL/strings.xml b/diaconn/src/main/res/values-iw-rIL/strings.xml index b4af81588a..4b5a63bed6 100644 --- a/diaconn/src/main/res/values-iw-rIL/strings.xml +++ b/diaconn/src/main/res/values-iw-rIL/strings.xml @@ -106,10 +106,16 @@ אתחול מערכת אחר עצירת חירום + בזאלי + בולוס ארוחה + בולוס רגיל + בולוס מרובע + בולוס כפול החלפת צינורית החלפת מחט החלפת מכל חסימת הזרקה (%s) + הפסק בזאלי (%s) רישום המזון נכשל הצלחה רישום המזון הצליח @@ -117,8 +123,13 @@ לא ניתן להגדיר שגיאת פרוטוקול ספציפי. הארוחה נרשמה, לא ניתן להזריק. בוטל על ידי המשאבה + בזמן הזרקת בולוס, הזרקות אחרות אינן אפשריות. בוטל עקב חוסר תגובה מהמשאבה. ההזרקה לא אפשרית עקב סוללה חלשה. + חסר אינסולין, לא ניתן להזריק. + ההזרקה לא אפשרית כי היא חורגת מהמינון היומי המותר. + לאחר סיום תצורת הבזאלי, תותר הזרקתו. + הפקודה לא נשלחה. בבקשה נסה שוב. רישום החלפת צינורית הוסף אירוע \"החלפת צינורית\" לפורטל הטיפולים כשימצא בהיסטוריה התחלת בזאלי זמני diff --git a/gradle/android_module_dependencies.gradle b/gradle/android_module_dependencies.gradle index 7125e612f7..d163350b9b 100644 --- a/gradle/android_module_dependencies.gradle +++ b/gradle/android_module_dependencies.gradle @@ -22,4 +22,9 @@ dependencies { annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" -} \ No newline at end of file +} + +allOpen { + // allows mocking for classes w/o directly opening them for release builds + annotation 'info.nightscout.androidaps.annotations.OpenForTesting' +} diff --git a/gradle/test_dependencies.gradle b/gradle/test_dependencies.gradle index 46c6cb21d9..741fabac14 100644 --- a/gradle/test_dependencies.gradle +++ b/gradle/test_dependencies.gradle @@ -1,11 +1,8 @@ dependencies { testImplementation "junit:junit:$junit_version" testImplementation 'org.json:json:20210307' - testImplementation "org.mockito:mockito-core:${mockitoVersion}" - testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}" - testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}" - testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}" - testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}" + testImplementation "org.mockito:mockito-core:$mockitoVersion" + testImplementation "org.mockito:mockito-inline:$mockitoVersion" testImplementation "joda-time:joda-time:$jodatime_version" testImplementation('com.google.truth:truth:1.1.3') { exclude group: "com.google.guava", module: "guava" @@ -18,7 +15,6 @@ dependencies { androidTestImplementation "androidx.test:rules:$androidx_rules" androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' - testImplementation 'org.mockito:mockito-inline:2.8.47' } android { diff --git a/insight/build.gradle b/insight/build.gradle index 46e26b9616..2f86ece0a2 100644 --- a/insight/build.gradle +++ b/insight/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/medtronic/build.gradle b/medtronic/build.gradle index f7106a59bd..136b5a3b05 100644 --- a/medtronic/build.gradle +++ b/medtronic/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt b/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt new file mode 100644 index 0000000000..ff88739ba2 --- /dev/null +++ b/medtronic/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -0,0 +1,39 @@ +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.* + +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/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt index d94c453c95..bbb4fcea86 100644 --- a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt +++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt @@ -1,9 +1,8 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.logging.AAPSLogger -import info.nightscout.androidaps.logging.AAPSLoggerTest import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil @@ -17,39 +16,30 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.Answers import org.mockito.Mock -import org.powermock.modules.junit4.PowerMockRunner /** * Created by andy on 11/1/18. */ -@RunWith(PowerMockRunner::class) -class MedtronicPumpHistoryDecoderUTest { +@Suppress("SpellCheckingInspection") +class MedtronicPumpHistoryDecoderUTest : TestBase() { - @Mock - var injector: HasAndroidInjector? = null - var aapsLogger: AAPSLogger = AAPSLoggerTest() + @Mock lateinit var injector: HasAndroidInjector + @Mock lateinit var resourceHelper: ResourceHelper + @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin + @Mock lateinit var rileyLinkUtil: RileyLinkUtil + @Mock lateinit var sp: SP + + private var medtronicPumpStatus: MedtronicPumpStatus? = null + private var medtronicUtil: MedtronicUtil? = null + private var decoder: MedtronicPumpHistoryDecoder? = null var rxBusWrapper = RxBusWrapper(TestAapsSchedulers()) - - @Mock - var resourceHelper: ResourceHelper? = null - - @Mock(answer = Answers.RETURNS_DEEP_STUBS) - var activePlugin: ActivePlugin? = null - - @Mock - var rileyLinkUtil: RileyLinkUtil? = null - - @Mock - var sp: SP? = null - var medtronicPumpStatus: MedtronicPumpStatus? = null - var medtronicUtil: MedtronicUtil? = null - var decoder: MedtronicPumpHistoryDecoder? = null @Before fun setup() { - medtronicPumpStatus = MedtronicPumpStatus(resourceHelper!!, sp!!, rxBusWrapper, rileyLinkUtil!!) - medtronicUtil = MedtronicUtil(aapsLogger, rxBusWrapper, rileyLinkUtil!!, medtronicPumpStatus!!) + medtronicPumpStatus = + MedtronicPumpStatus(resourceHelper, sp, rxBusWrapper, rileyLinkUtil) + medtronicUtil = + MedtronicUtil(aapsLogger, rxBusWrapper, rileyLinkUtil, medtronicPumpStatus!!) decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil!!, ByteUtil()) } @@ -178,32 +168,42 @@ class MedtronicPumpHistoryDecoderUTest { } */ @Test @Throws(Exception::class) fun historyProblem_148_amunhateb() { - val pumpHistoryEntries = readAndParseHistoryPage("5A 0F 20 F4 0C 03 15 19 11 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 11 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 01 12 12 00 25 DE 2D 43 15 01 50 50 00 26 EA 2D 43 15 01 4B 4B 00 2C C9 34 43 15 62 00 2F CB 17 03 15 01 33 33 00 16 DE 37 43 15 07 00 00 07 FE 23 95 6D 23 95 0A 08 00 2B 00 00 00 00 07 FE 03 8E 2C 04 70 38 00 00 04 70 38 00 00 00 00 00 00 04 70 64 06 00 00 00 06 08 00 2B 00 00 00 2C A0 2F E3 01 04 15 33 00 2F E7 04 44 15 00 16 03 2F E7 04 44 15 33 28 3B C2 06 44 15 00 16 01 3B C2 06 44 15 08 08 17 DB 0B 44 15 00 26 00 06 26 00 0C 26 00 12 28 00 18 26 00 1E 26 00 24 24 00 2A 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 17 DB 0B 44 15 00 26 00 02 26 00 04 26 00 06 24 00 08 24 00 0A 24 00 0C 26 00 0E 26 00 10 26 00 12 28 00 14 28 00 16 28 00 18 26 00 1A 26 00 1C 26 00 1E 26 00 20 26 00 22 26 00 24 24 00 26 24 00 28 24 00 2A 26 00 2C 26 00 2E 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 45 45 00 28 E9 2B 44 15 19 00 00 C1 0D 04 15 1A 00 15 C3 0D 04 15 1A 01 33 C3 0D 04 15 01 28 28 00 07 CC 2E 44 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 2D", - MedtronicDeviceType.Medtronic_522_722) + val pumpHistoryEntries = readAndParseHistoryPage( + "5A 0F 20 F4 0C 03 15 19 11 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 11 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 01 12 12 00 25 DE 2D 43 15 01 50 50 00 26 EA 2D 43 15 01 4B 4B 00 2C C9 34 43 15 62 00 2F CB 17 03 15 01 33 33 00 16 DE 37 43 15 07 00 00 07 FE 23 95 6D 23 95 0A 08 00 2B 00 00 00 00 07 FE 03 8E 2C 04 70 38 00 00 04 70 38 00 00 00 00 00 00 04 70 64 06 00 00 00 06 08 00 2B 00 00 00 2C A0 2F E3 01 04 15 33 00 2F E7 04 44 15 00 16 03 2F E7 04 44 15 33 28 3B C2 06 44 15 00 16 01 3B C2 06 44 15 08 08 17 DB 0B 44 15 00 26 00 06 26 00 0C 26 00 12 28 00 18 26 00 1E 26 00 24 24 00 2A 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 17 DB 0B 44 15 00 26 00 02 26 00 04 26 00 06 24 00 08 24 00 0A 24 00 0C 26 00 0E 26 00 10 26 00 12 28 00 14 28 00 16 28 00 18 26 00 1A 26 00 1C 26 00 1E 26 00 20 26 00 22 26 00 24 24 00 26 24 00 28 24 00 2A 26 00 2C 26 00 2E 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 45 45 00 28 E9 2B 44 15 19 00 00 C1 0D 04 15 1A 00 15 C3 0D 04 15 1A 01 33 C3 0D 04 15 01 28 28 00 07 CC 2E 44 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 2D", + MedtronicDeviceType.Medtronic_522_722 + ) Assert.assertEquals(20, pumpHistoryEntries.size.toLong()) } @Test @Throws(Exception::class) fun historyProblem_423_duzy78() { - val pumpHistoryEntries = readAndParseHistoryPage("16 00 08 D0 0E 51 15 33 60 0A D0 0E 51 15 00 16 01 0A D0 0E 51 15 33 00 07 DF 0E 51 15 00 16 00 07 DF 0E 51 15 33 6C 09 DF 0E 51 15 00 16 01 09 DF 0E 51 15 33 00 25 ED 0E 51 15 00 16 00 25 ED 0E 51 15 33 2C 27 ED 0E 51 15 00 16 01 27 ED 0E 51 15 33 00 07 F4 0E 51 15 00 16 00 07 F4 0E 51 15 33 00 09 F4 0E 51 15 00 16 01 09 F4 0E 51 15 33 2C 25 D5 0F 51 15 00 16 01 25 D5 0F 51 15 01 3C 3C 00 30 D5 4F 51 15 33 2C 25 F7 0F 51 15 00 16 01 25 F7 0F 51 15 33 00 07 C6 10 51 15 00 16 00 07 C6 10 51 15 33 30 09 C6 10 51 15 00 16 01 09 C6 10 51 15 33 30 25 E8 10 51 15 00 16 01 25 E8 10 51 15 33 30 24 CF 11 51 15 00 16 01 24 CF 11 51 15 33 00 23 E4 11 51 15 00 16 00 23 E4 11 51 15 33 3C 25 E4 11 51 15 00 16 01 25 E4 11 51 15 33 00 23 E8 11 51 15 00 16 00 23 E8 11 51 15 33 4A 25 E8 11 51 15 00 16 01 25 E8 11 51 15 33 00 19 EE 11 51 15 00 16 00 19 EE 11 51 15 33 30 1B EE 11 51 15 00 16 01 1B EE 11 51 15 33 00 23 F2 11 51 15 00 16 00 23 F2 11 51 15 33 3E 25 F2 11 51 15 00 16 01 25 F2 11 51 15 33 00 24 C0 12 51 15 00 16 00 24 C0 12 51 15 33 5E 25 C0 12 51 15 00 16 01 25 C0 12 51 15 33 00 23 CF 12 51 15 00 16 00 23 CF 12 51 15 33 64 25 CF 12 51 15 00 16 01 25 CF 12 51 15 33 00 23 D9 12 51 15 00 16 00 23 D9 12 51 15 33 6A 25 D9 12 51 15 00 16 01 25 D9 12 51 15 33 00 23 E9 12 51 15 00 16 00 23 E9 12 51 15 33 30 25 E9 12 51 15 00 16 01 25 E9 12 51 15 01 16 16 00 10 C2 53 51 15 33 30 24 CF 13 51 15 00 16 01 24 CF 13 51 15 33 30 04 EE 13 51 15 00 16 01 04 EE 13 51 15 01 14 14 00 3B F0 53 51 15 33 00 22 C0 14 51 15 00 16 00 22 C0 14 51 15 33 22 24 C0 14 51 15 00 16 01 24 C0 14 51 15 33 22 03 DF 14 51 15 00 16 01 03 DF 14 51 15 1E 00 37 E1 14 11 15 1F 00 01 EE 14 11 15 33 22 03 C6 15 51 15 00 16 01 03 C6 15 51 15 33 00 20 D9 15 51 15 00 16 00 20 D9 15 51 15 33 34 22 D9 15 51 15 00 16 01 22 D9 15 51 15 39 14 0E DF 35 71 15 83 92 40 01 0B 0B 00 37 E0 55 51 15 33 00 21 E3 15 51 15 00 16 00 21 E3 15 51 15 33 22 22 E3 15 51 15 00 16 01 22 E3 15 51 15 33 00 21 E8 15 51 15 00 16 00 21 E8 15 51 15 33 30 23 E8 15 51 15 00 16 01 23 E8 15 51 15 33 00 20 ED 15 51 15 00 16 00 20 ED 15 51 15 33 22 22 ED 15 51 15 00 16 01 22 ED 15 51 15 33 00 03 F8 15 51 15 00 16 00 03 F8 15 51 15 33 32 05 F8 15 51 15 00 16 01 05 F8 15 51 15 33 00 01 CB 16 51 15 00 16 00 01 CB 16 51 15 33 20 03 CB 16 51 15 00 16 01 03 CB 16 51 15 33 2A 20 ED 16 51 15 00 16 01 20 ED 16 51 15 33 00 02 F8 16 51 15 00 16 00 02 F8 16 51 15 33 2C 04 F8 16 51 15 00 16 01 04 F8 16 51 15 33 00 1F CA 17 51 15 00 16 00 1F CA 17 51 15 33 34 21 CA 17 51 15 00 16 01 21 CA 17 51 15 33 00 1F D4 17 51 15 00 16 00 1F D4 17 51 15 33 38 21 D4 17 51 15 00 16 01 21 D4 17 51 15 33 00 15 EE 17 51 15 00 16 00 15 EE 17 51 15 33 42 17 EE 17 51 15 00 16 01 17 EE 17 51 15 07 00 00 08 0A 31 95 6C 31 95 05 00 A1 A1 A1 01 00 00 08 0A 04 8E 39 03 7C 2B 00 00 03 7C 2B 00 00 00 00 00 00 03 7C 64 07 00 00 00 07 33 00 05 C1 00 52 15 00 16 00 05 C1 00 52 15 33 50 07 C1 00 52 15 00 16 01 07 C1 00 52 15 33 00 01 CB 00 52 15 00 16 00 01 CB 00 52 15 33 26 03 CB 00 52 15 00 16 01 03 CB 00 52 15 33 00 1E DE 00 52 15 00 00 00 8F 0E", - MedtronicDeviceType.Medtronic_515_715) + val pumpHistoryEntries = readAndParseHistoryPage( + "16 00 08 D0 0E 51 15 33 60 0A D0 0E 51 15 00 16 01 0A D0 0E 51 15 33 00 07 DF 0E 51 15 00 16 00 07 DF 0E 51 15 33 6C 09 DF 0E 51 15 00 16 01 09 DF 0E 51 15 33 00 25 ED 0E 51 15 00 16 00 25 ED 0E 51 15 33 2C 27 ED 0E 51 15 00 16 01 27 ED 0E 51 15 33 00 07 F4 0E 51 15 00 16 00 07 F4 0E 51 15 33 00 09 F4 0E 51 15 00 16 01 09 F4 0E 51 15 33 2C 25 D5 0F 51 15 00 16 01 25 D5 0F 51 15 01 3C 3C 00 30 D5 4F 51 15 33 2C 25 F7 0F 51 15 00 16 01 25 F7 0F 51 15 33 00 07 C6 10 51 15 00 16 00 07 C6 10 51 15 33 30 09 C6 10 51 15 00 16 01 09 C6 10 51 15 33 30 25 E8 10 51 15 00 16 01 25 E8 10 51 15 33 30 24 CF 11 51 15 00 16 01 24 CF 11 51 15 33 00 23 E4 11 51 15 00 16 00 23 E4 11 51 15 33 3C 25 E4 11 51 15 00 16 01 25 E4 11 51 15 33 00 23 E8 11 51 15 00 16 00 23 E8 11 51 15 33 4A 25 E8 11 51 15 00 16 01 25 E8 11 51 15 33 00 19 EE 11 51 15 00 16 00 19 EE 11 51 15 33 30 1B EE 11 51 15 00 16 01 1B EE 11 51 15 33 00 23 F2 11 51 15 00 16 00 23 F2 11 51 15 33 3E 25 F2 11 51 15 00 16 01 25 F2 11 51 15 33 00 24 C0 12 51 15 00 16 00 24 C0 12 51 15 33 5E 25 C0 12 51 15 00 16 01 25 C0 12 51 15 33 00 23 CF 12 51 15 00 16 00 23 CF 12 51 15 33 64 25 CF 12 51 15 00 16 01 25 CF 12 51 15 33 00 23 D9 12 51 15 00 16 00 23 D9 12 51 15 33 6A 25 D9 12 51 15 00 16 01 25 D9 12 51 15 33 00 23 E9 12 51 15 00 16 00 23 E9 12 51 15 33 30 25 E9 12 51 15 00 16 01 25 E9 12 51 15 01 16 16 00 10 C2 53 51 15 33 30 24 CF 13 51 15 00 16 01 24 CF 13 51 15 33 30 04 EE 13 51 15 00 16 01 04 EE 13 51 15 01 14 14 00 3B F0 53 51 15 33 00 22 C0 14 51 15 00 16 00 22 C0 14 51 15 33 22 24 C0 14 51 15 00 16 01 24 C0 14 51 15 33 22 03 DF 14 51 15 00 16 01 03 DF 14 51 15 1E 00 37 E1 14 11 15 1F 00 01 EE 14 11 15 33 22 03 C6 15 51 15 00 16 01 03 C6 15 51 15 33 00 20 D9 15 51 15 00 16 00 20 D9 15 51 15 33 34 22 D9 15 51 15 00 16 01 22 D9 15 51 15 39 14 0E DF 35 71 15 83 92 40 01 0B 0B 00 37 E0 55 51 15 33 00 21 E3 15 51 15 00 16 00 21 E3 15 51 15 33 22 22 E3 15 51 15 00 16 01 22 E3 15 51 15 33 00 21 E8 15 51 15 00 16 00 21 E8 15 51 15 33 30 23 E8 15 51 15 00 16 01 23 E8 15 51 15 33 00 20 ED 15 51 15 00 16 00 20 ED 15 51 15 33 22 22 ED 15 51 15 00 16 01 22 ED 15 51 15 33 00 03 F8 15 51 15 00 16 00 03 F8 15 51 15 33 32 05 F8 15 51 15 00 16 01 05 F8 15 51 15 33 00 01 CB 16 51 15 00 16 00 01 CB 16 51 15 33 20 03 CB 16 51 15 00 16 01 03 CB 16 51 15 33 2A 20 ED 16 51 15 00 16 01 20 ED 16 51 15 33 00 02 F8 16 51 15 00 16 00 02 F8 16 51 15 33 2C 04 F8 16 51 15 00 16 01 04 F8 16 51 15 33 00 1F CA 17 51 15 00 16 00 1F CA 17 51 15 33 34 21 CA 17 51 15 00 16 01 21 CA 17 51 15 33 00 1F D4 17 51 15 00 16 00 1F D4 17 51 15 33 38 21 D4 17 51 15 00 16 01 21 D4 17 51 15 33 00 15 EE 17 51 15 00 16 00 15 EE 17 51 15 33 42 17 EE 17 51 15 00 16 01 17 EE 17 51 15 07 00 00 08 0A 31 95 6C 31 95 05 00 A1 A1 A1 01 00 00 08 0A 04 8E 39 03 7C 2B 00 00 03 7C 2B 00 00 00 00 00 00 03 7C 64 07 00 00 00 07 33 00 05 C1 00 52 15 00 16 00 05 C1 00 52 15 33 50 07 C1 00 52 15 00 16 01 07 C1 00 52 15 33 00 01 CB 00 52 15 00 16 00 01 CB 00 52 15 33 26 03 CB 00 52 15 00 16 01 03 CB 00 52 15 33 00 1E DE 00 52 15 00 00 00 8F 0E", + MedtronicDeviceType.Medtronic_515_715 + ) Assert.assertEquals(131, pumpHistoryEntries.size.toLong()) } @Test @Throws(Exception::class) fun historyProblem_476_OpossumGit() { - val pumpHistoryEntries = readAndParseHistoryPage("08 07 50 05 0D 4D 15 00 18 00 08 14 00 0E 10 00 14 08 00 1E 12 00 26 16 00 2B 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 50 05 0D 4D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04 04 00 44 09 4D 4D 15 33 06 57 15 0D 4D 15 00 16 01 57 15 0D 4D 15 33 00 77 15 0D 4D 15 00 16 00 77 15 0D 4D 15 33 00 5D 16 0D 4D 15 00 16 04 5D 16 0D 4D 15 33 00 61 1A 0D 4D 15 00 16 00 61 1A 0D 4D 15 5D 00 5E 31 0D 0D 15 1A 00 6E 31 0D 0D 15 06 03 04 D2 6E 31 6D 0D 15 0C 03 11 40 00 01 05 64 01 13 40 00 01 05 17 00 0A 41 00 01 05 18 00 40 39 15 0D 15 21 00 53 04 16 0D 15 03 00 00 00 58 57 09 36 0D 15 5D 01 78 0A 16 0D 15 64 01 78 0A 16 8D 15 2C 68 78 0A 16 8D 15 24 3C 78 0A 16 8D 15 63 02 78 0A 16 8D 15 1B 12 78 0A 16 8D 15 65 61 78 0A 16 8D 15 61 00 78 0A 16 8D 15 32 0E 78 0A 16 8D 15 66 00 78 0A 16 8D 15 3C 01 78 0A 16 8D 15 3D 88 32 93 00 00 00 3E 00 00 00 00 00 00 26 01 78 0A 16 8D 15 27 01 B2 08 00 00 00 28 00 00 00 00 00 00 60 00 78 0A 16 4D 15 23 00 78 0A 16 8D 15 5E 01 78 0A 16 8D 15 2D 01 78 0A 16 8D 15 5A 0F 78 0A 16 8D 15 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 62 00 78 0A 16 8D 15 5F 51 78 0A 16 8D 15 4F 00 78 0A 16 8D 15 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 08 18 78 0A 16 8D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D6 06", - MedtronicDeviceType.Medtronic_522_722) + val pumpHistoryEntries = readAndParseHistoryPage( + "08 07 50 05 0D 4D 15 00 18 00 08 14 00 0E 10 00 14 08 00 1E 12 00 26 16 00 2B 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 50 05 0D 4D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04 04 00 44 09 4D 4D 15 33 06 57 15 0D 4D 15 00 16 01 57 15 0D 4D 15 33 00 77 15 0D 4D 15 00 16 00 77 15 0D 4D 15 33 00 5D 16 0D 4D 15 00 16 04 5D 16 0D 4D 15 33 00 61 1A 0D 4D 15 00 16 00 61 1A 0D 4D 15 5D 00 5E 31 0D 0D 15 1A 00 6E 31 0D 0D 15 06 03 04 D2 6E 31 6D 0D 15 0C 03 11 40 00 01 05 64 01 13 40 00 01 05 17 00 0A 41 00 01 05 18 00 40 39 15 0D 15 21 00 53 04 16 0D 15 03 00 00 00 58 57 09 36 0D 15 5D 01 78 0A 16 0D 15 64 01 78 0A 16 8D 15 2C 68 78 0A 16 8D 15 24 3C 78 0A 16 8D 15 63 02 78 0A 16 8D 15 1B 12 78 0A 16 8D 15 65 61 78 0A 16 8D 15 61 00 78 0A 16 8D 15 32 0E 78 0A 16 8D 15 66 00 78 0A 16 8D 15 3C 01 78 0A 16 8D 15 3D 88 32 93 00 00 00 3E 00 00 00 00 00 00 26 01 78 0A 16 8D 15 27 01 B2 08 00 00 00 28 00 00 00 00 00 00 60 00 78 0A 16 4D 15 23 00 78 0A 16 8D 15 5E 01 78 0A 16 8D 15 2D 01 78 0A 16 8D 15 5A 0F 78 0A 16 8D 15 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 62 00 78 0A 16 8D 15 5F 51 78 0A 16 8D 15 4F 00 78 0A 16 8D 15 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 08 18 78 0A 16 8D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D6 06", + MedtronicDeviceType.Medtronic_522_722 + ) Assert.assertEquals(41, pumpHistoryEntries.size.toLong()) } @Throws(Exception::class) - private fun readAndParseHistoryPage(historyPageString: String, medtronicDeviceType: MedtronicDeviceType): List { + private fun readAndParseHistoryPage( + historyPageString: String, + medtronicDeviceType: MedtronicDeviceType + ): List { val historyPageData = ByteUtil.createByteArrayFromString(historyPageString) aapsLogger.debug("History Page Length:" + historyPageData.size) medtronicUtil!!.medtronicPumpModel = medtronicDeviceType medtronicUtil!!.isModelSet = true val historyPage = RawHistoryPage(aapsLogger) historyPage.appendData(historyPageData) - val pumpHistoryEntries: List = decoder!!.processPageAndCreateRecords(historyPage) + val pumpHistoryEntries: List = + decoder!!.processPageAndCreateRecords(historyPage) displayHistoryRecords(pumpHistoryEntries) return pumpHistoryEntries } diff --git a/omnipod-common/build.gradle b/omnipod-common/build.gradle index aba1f22144..6c5d9d7776 100644 --- a/omnipod-common/build.gradle +++ b/omnipod-common/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/omnipod-eros/build.gradle b/omnipod-eros/build.gradle index db27c83b0e..4cf2467f9f 100644 --- a/omnipod-eros/build.gradle +++ b/omnipod-eros/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/omnipod-eros/src/test/java/info/nightscout/androidaps/TestBase.kt b/omnipod-eros/src/test/java/info/nightscout/androidaps/TestBase.kt new file mode 100644 index 0000000000..ff88739ba2 --- /dev/null +++ b/omnipod-eros/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -0,0 +1,39 @@ +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.* + +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/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java deleted file mode 100644 index 0bc6625a5f..0000000000 --- a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.java +++ /dev/null @@ -1,149 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.eros; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import android.os.Looper; - -import org.joda.time.DateTimeZone; -import org.joda.time.tz.UTCProvider; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Answers; -import org.mockito.Mock; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.ArrayList; - -import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.interfaces.Profile; -import info.nightscout.androidaps.data.PumpEnactResult; -import info.nightscout.androidaps.interfaces.ActivePlugin; -import info.nightscout.androidaps.interfaces.CommandQueueProvider; -import info.nightscout.androidaps.interfaces.PumpSync; -import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.logging.AAPSLoggerTest; -import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; -import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; -import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager; -import info.nightscout.androidaps.utils.resources.ResourceHelper; -import info.nightscout.androidaps.utils.rx.TestAapsSchedulers; - - -@RunWith(PowerMockRunner.class) -public class OmnipodErosPumpPluginTest { - - @Mock HasAndroidInjector injector; - AAPSLogger aapsLogger = new AAPSLoggerTest(); - RxBusWrapper rxBusWrapper = new RxBusWrapper(new TestAapsSchedulers()); - @Mock ResourceHelper resourceHelper; - @Mock(answer = Answers.RETURNS_DEEP_STUBS) ActivePlugin activePlugin; - @Mock AapsOmnipodErosManager aapsOmnipodErosManager; - @Mock CommandQueueProvider commandQueueProvider; - @Mock RileyLinkUtil rileyLinkUtil; - @Mock PumpSync pumpSync; - - @Before - public void prepare() { - when(resourceHelper.gs(anyInt(), anyLong())).thenReturn(""); - } - - @Test - @PrepareForTest(Looper.class) - public void testSetTempBasalPercent() { - - DateTimeZone.setProvider(new UTCProvider()); - - // mock all the things - PowerMockito.mockStatic(Looper.class); - OmnipodErosPumpPlugin plugin = new OmnipodErosPumpPlugin(injector, aapsLogger, new TestAapsSchedulers(), rxBusWrapper, null, - resourceHelper, activePlugin, null, null, aapsOmnipodErosManager, commandQueueProvider, - null, null, null, null, - rileyLinkUtil, null, null, pumpSync - ); - PumpSync.PumpState pumpState = new PumpSync.PumpState(null, null, null, null); - when(pumpSync.expectedPumpState()).thenReturn(pumpState); - when(rileyLinkUtil.getRileyLinkHistory()).thenReturn(new ArrayList<>()); - when(injector.androidInjector()).thenReturn(instance -> { - }); - Profile profile = mock(Profile.class); - - - // always return a PumpEnactResult containing same rate and duration as input - when(aapsOmnipodErosManager.setTemporaryBasal(any(TempBasalPair.class))).thenAnswer( - invocation -> { - TempBasalPair pair = invocation.getArgument(0); - PumpEnactResult result = new PumpEnactResult(injector); - result.absolute(pair.getInsulinRate()); - result.duration(pair.getDurationMinutes()); - return result; - }); - - - // Given standard basal - when(profile.getBasal()).thenReturn(0.5d); - // When - PumpEnactResult result1 = plugin.setTempBasalPercent(80, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL); - PumpEnactResult result2 = plugin.setTempBasalPercent(5000, 30000, profile, false, PumpSync.TemporaryBasalType.NORMAL); - PumpEnactResult result3 = plugin.setTempBasalPercent(0, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL); - PumpEnactResult result4 = plugin.setTempBasalPercent(0, 0, profile, false, PumpSync.TemporaryBasalType.NORMAL); - PumpEnactResult result5 = plugin.setTempBasalPercent(-50, 60, profile, false, PumpSync.TemporaryBasalType.NORMAL); - // Then return correct values - assertEquals(result1.getAbsolute(), 0.4d, 0.01d); - assertEquals(result1.getDuration(), 30); - assertEquals(result2.getAbsolute(), 25d, 0.01d); - assertEquals(result2.getDuration(), 30000); - assertEquals(result3.getAbsolute(), 0d, 0.01d); - assertEquals(result3.getDuration(), 30); - assertEquals(result4.getAbsolute(), -1d, 0.01d); - assertEquals(result4.getDuration(), -1); - // this is validated downstream, see TempBasalExtraCommand - assertEquals(result5.getAbsolute(), -0.25d, 0.01d); - assertEquals(result5.getDuration(), 60); - - // Given zero basal - when(profile.getBasal()).thenReturn(0d); - // When - result1 = plugin.setTempBasalPercent(8000, 90, profile, false, PumpSync.TemporaryBasalType.NORMAL); - result2 = plugin.setTempBasalPercent(0, 0, profile, false, PumpSync.TemporaryBasalType.NORMAL); - // Then return zero values - assertEquals(result1.getAbsolute(), 0d, 0.01d); - assertEquals(result1.getDuration(), 90); - assertEquals(result2.getAbsolute(), -1d, 0.01d); - assertEquals(result2.getDuration(), -1); - - // Given unhealthy basal - when(profile.getBasal()).thenReturn(500d); - // When treatment - result1 = plugin.setTempBasalPercent(80, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL); - // Then return sane values - assertEquals(result1.getAbsolute(), PumpType.OMNIPOD_EROS.determineCorrectBasalSize(500d * 0.8), 0.01d); - assertEquals(result1.getDuration(), 30); - - // Given weird basal - when(profile.getBasal()).thenReturn(1.234567d); - // When treatment - result1 = plugin.setTempBasalPercent(280, 600, profile, false, PumpSync.TemporaryBasalType.NORMAL); - // Then return sane values - assertEquals(result1.getAbsolute(), 3.4567876, 0.01d); - assertEquals(result1.getDuration(), 600); - - // Given negative basal - when(profile.getBasal()).thenReturn(-1.234567d); - // When treatment - result1 = plugin.setTempBasalPercent(280, 510, profile, false, PumpSync.TemporaryBasalType.NORMAL); - // Then return negative value (this is validated further downstream, see TempBasalExtraCommand) - assertEquals(result1.getAbsolute(), -3.4567876, 0.01d); - assertEquals(result1.getDuration(), 510); - } - -} diff --git a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt new file mode 100644 index 0000000000..9655fe8bb7 --- /dev/null +++ b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt @@ -0,0 +1,157 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.eros + +import dagger.android.AndroidInjector +import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.TestBase +import info.nightscout.androidaps.data.PumpEnactResult +import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.interfaces.CommandQueueProvider +import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.interfaces.PumpSync +import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.plugins.pump.common.defs.PumpType +import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil +import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager +import info.nightscout.androidaps.utils.resources.ResourceHelper +import info.nightscout.androidaps.utils.rx.TestAapsSchedulers +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.mockito.Answers +import org.mockito.ArgumentMatchers +import org.mockito.Mock +import org.mockito.Mockito +import org.mockito.Mockito.`when` +import org.mockito.invocation.InvocationOnMock +import java.util.* + +class OmnipodErosPumpPluginTest : TestBase() { + + @Mock lateinit var injector: HasAndroidInjector + @Mock lateinit var resourceHelper: ResourceHelper + @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin + @Mock lateinit var aapsOmnipodErosManager: AapsOmnipodErosManager + @Mock lateinit var commandQueueProvider: CommandQueueProvider + @Mock lateinit var rileyLinkUtil: RileyLinkUtil + @Mock lateinit var pumpSync: PumpSync + + var rxBusWrapper = RxBusWrapper(TestAapsSchedulers()) + + @Before fun prepare() { + `when`(resourceHelper.gs(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong())) + .thenReturn("") + } + + @Test fun testSetTempBasalPercent() { + DateTimeZone.setProvider(UTCProvider()) + + // mock all the things + val plugin = OmnipodErosPumpPlugin( + injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null, + resourceHelper, activePlugin, null, null, aapsOmnipodErosManager, commandQueueProvider, + null, null, null, null, + rileyLinkUtil, null, null, pumpSync + ) + val pumpState = PumpSync.PumpState(null, null, null, null) + `when`(pumpSync.expectedPumpState()).thenReturn(pumpState) + `when`(rileyLinkUtil.rileyLinkHistory).thenReturn(ArrayList()) + `when`(injector.androidInjector()).thenReturn( + AndroidInjector { }) + val profile = Mockito.mock( + Profile::class.java + ) + + // always return a PumpEnactResult containing same rate and duration as input + `when`( + aapsOmnipodErosManager.setTemporaryBasal( + ArgumentMatchers.any( + TempBasalPair::class.java + ) + ) + ).thenAnswer { invocation: InvocationOnMock -> + val pair = invocation.getArgument(0) + val result = PumpEnactResult(injector) + result.absolute(pair.insulinRate) + result.duration(pair.durationMinutes) + result + } + + // Given standard basal + `when`(profile.getBasal()).thenReturn(0.5) + // When + var result1 = + plugin.setTempBasalPercent(80, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL) + var result2 = plugin.setTempBasalPercent( + 5000, + 30000, + profile, + false, + PumpSync.TemporaryBasalType.NORMAL + ) + val result3 = + plugin.setTempBasalPercent(0, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL) + val result4 = + plugin.setTempBasalPercent(0, 0, profile, false, PumpSync.TemporaryBasalType.NORMAL) + val result5 = + plugin.setTempBasalPercent(-50, 60, profile, false, PumpSync.TemporaryBasalType.NORMAL) + // Then return correct values + Assert.assertEquals(result1.absolute, 0.4, 0.01) + Assert.assertEquals(result1.duration, 30) + Assert.assertEquals(result2.absolute, 25.0, 0.01) + Assert.assertEquals(result2.duration, 30000) + Assert.assertEquals(result3.absolute, 0.0, 0.01) + Assert.assertEquals(result3.duration, 30) + Assert.assertEquals(result4.absolute, -1.0, 0.01) + Assert.assertEquals(result4.duration, -1) + // this is validated downstream, see TempBasalExtraCommand + Assert.assertEquals(result5.absolute, -0.25, 0.01) + Assert.assertEquals(result5.duration, 60) + + // Given zero basal + `when`(profile.getBasal()).thenReturn(0.0) + // When + result1 = + plugin.setTempBasalPercent(8000, 90, profile, false, PumpSync.TemporaryBasalType.NORMAL) + result2 = + plugin.setTempBasalPercent(0, 0, profile, false, PumpSync.TemporaryBasalType.NORMAL) + // Then return zero values + Assert.assertEquals(result1.absolute, 0.0, 0.01) + Assert.assertEquals(result1.duration, 90) + Assert.assertEquals(result2.absolute, -1.0, 0.01) + Assert.assertEquals(result2.duration, -1) + + // Given unhealthy basal + `when`(profile.getBasal()).thenReturn(500.0) + // When treatment + result1 = + plugin.setTempBasalPercent(80, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL) + // Then return sane values + Assert.assertEquals( + result1.absolute, + PumpType.OMNIPOD_EROS.determineCorrectBasalSize(500.0 * 0.8), + 0.01 + ) + Assert.assertEquals(result1.duration, 30) + + // Given weird basal + `when`(profile.getBasal()).thenReturn(1.234567) + // When treatment + result1 = + plugin.setTempBasalPercent(280, 600, profile, false, PumpSync.TemporaryBasalType.NORMAL) + // Then return sane values + Assert.assertEquals(result1.absolute, 3.4567876, 0.01) + Assert.assertEquals(result1.duration, 600) + + // Given negative basal + `when`(profile.getBasal()).thenReturn(-1.234567) + // When treatment + result1 = + plugin.setTempBasalPercent(280, 510, profile, false, PumpSync.TemporaryBasalType.NORMAL) + // Then return negative value (this is validated further downstream, see TempBasalExtraCommand) + Assert.assertEquals(result1.absolute, -3.4567876, 0.01) + Assert.assertEquals(result1.duration, 510) + } +} \ No newline at end of file diff --git a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java index fb14b39eda..487c24861c 100644 --- a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java +++ b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.java @@ -1,10 +1,12 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.joda.time.Duration; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.powermock.api.mockito.PowerMockito; import java.util.List; @@ -13,33 +15,16 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.sc import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalScheduleEntry; import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - public class AapsOmnipodErosManagerTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); @Test public void validProfile() { Profile profile = mock(Profile.class); - Profile.ProfileValue value1 = mock(Profile.ProfileValue.class); - value1.setTimeAsSeconds(0); - value1.setValue(0.5D); - - Profile.ProfileValue value2 = mock(Profile.ProfileValue.class); - value2.setTimeAsSeconds(18000); - value2.setValue(1.0D); - - Profile.ProfileValue value3 = mock(Profile.ProfileValue.class); - value3.setTimeAsSeconds(50400); - value3.setValue(3.05D); - - PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ - value1, - value2, - value3 + when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + new Profile.ProfileValue(0, 0.5), + new Profile.ProfileValue(18000, 1.0), + new Profile.ProfileValue(50400, 3.05) }); BasalSchedule basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile); @@ -62,98 +47,63 @@ public class AapsOmnipodErosManagerTest { @Test public void invalidProfileNullProfile() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Profile can not be null"); - AapsOmnipodErosManager.mapProfileToBasalSchedule(null); + assertThrows("Profile can not be null", IllegalArgumentException.class, () -> AapsOmnipodErosManager.mapProfileToBasalSchedule(null)); } @Test public void invalidProfileNullEntries() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Basal values can not be null"); - AapsOmnipodErosManager.mapProfileToBasalSchedule(mock(Profile.class)); + assertThrows("Basal values can not be null", IllegalArgumentException.class, () -> AapsOmnipodErosManager.mapProfileToBasalSchedule(mock(Profile.class))); } @Test public void invalidProfileZeroEntries() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Entries can not be empty"); Profile profile = mock(Profile.class); - PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[0]); + when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[0]); - AapsOmnipodErosManager.mapProfileToBasalSchedule(profile); + assertThrows("Entries can not be empty", IllegalArgumentException.class, () -> AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)); } @Test public void invalidProfileNonZeroOffset() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("First basal schedule entry should have 0 offset"); - Profile profile = mock(Profile.class); - Profile.ProfileValue value = mock(Profile.ProfileValue.class); - value.setTimeAsSeconds(1800); - value.setValue(0.5D); - - PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ - value, + when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + new Profile.ProfileValue(1800, 0.5) }); - AapsOmnipodErosManager.mapProfileToBasalSchedule(profile); + assertThrows("First basal schedule entry should have 0 offset", IllegalArgumentException.class, () -> AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)); } @Test public void invalidProfileMoreThan24Hours() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Invalid start time"); - Profile profile = mock(Profile.class); - Profile.ProfileValue value1 = mock(Profile.ProfileValue.class); - value1.setTimeAsSeconds(0); - value1.setValue(0.5D); - - Profile.ProfileValue value2 = mock(Profile.ProfileValue.class); - value2.setTimeAsSeconds(86400); - value2.setValue(0.5D); - - PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ - value1, - value2 + when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + new Profile.ProfileValue(0, 0.5), + new Profile.ProfileValue(86400, 0.5) }); - AapsOmnipodErosManager.mapProfileToBasalSchedule(profile); + assertThrows("Invalid start time", IllegalArgumentException.class, () -> AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)); } @Test public void invalidProfileNegativeOffset() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Invalid start time"); - Profile profile = mock(Profile.class); - Profile.ProfileValue value = mock(Profile.ProfileValue.class); - value.setTimeAsSeconds(-1); - value.setValue(0.5D); - - PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ - value, + when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + new Profile.ProfileValue(-1, 0.5) }); - AapsOmnipodErosManager.mapProfileToBasalSchedule(profile); + assertThrows("Invalid start time", IllegalArgumentException.class, () -> AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)); } @Test public void roundsToSupportedPrecision() { Profile profile = mock(Profile.class); - Profile.ProfileValue value = mock(Profile.ProfileValue.class); - value.setTimeAsSeconds(0); - value.setValue(0.04D); - - PowerMockito.when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ - value, + when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ + new Profile.ProfileValue(0, 0.04), }); BasalSchedule basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile); diff --git a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.java b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.java deleted file mode 100644 index 595cad0672..0000000000 --- a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.eros.manager; - -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.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.powermock.modules.junit4.PowerMockRunner; - -import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FirmwareVersion; -import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus; -import info.nightscout.androidaps.utils.rx.TestAapsSchedulers; -import info.nightscout.androidaps.utils.sharedPreferences.SP; - -import static org.junit.Assert.assertEquals; - -@RunWith(PowerMockRunner.class) -public class AapsErosPodStateManagerTest { - @Mock AAPSLogger aapsLogger; - @Mock SP sp; - - private RxBusWrapper rxBus = new RxBusWrapper(new TestAapsSchedulers()); - - @Test - public void times() { - DateTimeZone timeZone = DateTimeZone.UTC; - DateTimeZone.setDefault(timeZone); - - DateTime now = new DateTime(2020, 1, 1, 1, 2, 3, timeZone); - - DateTimeUtils.setCurrentMillisFixed(now.getMillis()); - - AapsErosPodStateManager podStateManager = new AapsErosPodStateManager(aapsLogger, sp, rxBus); - podStateManager.initState(0x0); - podStateManager.setInitializationParameters(0, 0, new FirmwareVersion(1, 1, 1), - new FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS); - - assertEquals(now, podStateManager.getTime()); - assertEquals(Duration.standardHours(1).plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), podStateManager.getScheduleOffset()); - } - - @Test - public void changeSystemTimeZoneWithoutChangingPodTimeZone() { - DateTimeZone timeZone = DateTimeZone.UTC; - DateTimeZone.setDefault(timeZone); - - DateTime now = new DateTime(2020, 1, 1, 1, 2, 3, timeZone); - - DateTimeUtils.setCurrentMillisFixed(now.getMillis()); - - AapsErosPodStateManager podStateManager = new AapsErosPodStateManager(aapsLogger, sp, rxBus); - podStateManager.initState(0x0); - podStateManager.setInitializationParameters(0, 0, new FirmwareVersion(1, 1, 1), - new FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS); - - DateTimeZone newTimeZone = DateTimeZone.forOffsetHours(2); - DateTimeZone.setDefault(newTimeZone); - - // The system time zone has been updated, but the pod session state's time zone hasn't - // So the pods time should not have been changed - assertEquals(now, podStateManager.getTime()); - assertEquals(Duration.standardHours(1).plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), podStateManager.getScheduleOffset()); - } - - @Test - public void changeSystemTimeZoneAndChangePodTimeZone() { - DateTimeZone timeZone = DateTimeZone.UTC; - DateTimeZone.setDefault(timeZone); - - DateTime now = new DateTime(2020, 1, 1, 1, 2, 3, timeZone); - - DateTimeUtils.setCurrentMillisFixed(now.getMillis()); - - AapsErosPodStateManager podStateManager = new AapsErosPodStateManager(aapsLogger, sp, rxBus); - podStateManager.initState(0x0); - podStateManager.setInitializationParameters(0, 0, new FirmwareVersion(1, 1, 1), - new FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS); - - DateTimeZone newTimeZone = DateTimeZone.forOffsetHours(2); - DateTimeZone.setDefault(newTimeZone); - podStateManager.setTimeZone(newTimeZone); - - // Both the system time zone have been updated - // So the pods time should have been changed (to +2 hours) - assertEquals(now.withZone(newTimeZone), podStateManager.getTime()); - assertEquals(Duration.standardHours(3).plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), podStateManager.getScheduleOffset()); - } - - @After - public void tearDown() { - DateTimeUtils.setCurrentMillisSystem(); - } -} \ No newline at end of file diff --git a/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt new file mode 100644 index 0000000000..6d21e22ac2 --- /dev/null +++ b/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt @@ -0,0 +1,95 @@ +package info.nightscout.androidaps.plugins.pump.omnipod.eros.manager + +import info.nightscout.androidaps.TestBase +import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FirmwareVersion +import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus +import info.nightscout.androidaps.utils.rx.TestAapsSchedulers +import info.nightscout.androidaps.utils.sharedPreferences.SP +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.mockito.Mock + +class AapsErosPodStateManagerTest : TestBase() { + + @Mock lateinit var sp: SP + + private val rxBus = RxBusWrapper(TestAapsSchedulers()) + + @Test fun times() { + val timeZone = DateTimeZone.UTC + DateTimeZone.setDefault(timeZone) + val now = DateTime(2020, 1, 1, 1, 2, 3, timeZone) + DateTimeUtils.setCurrentMillisFixed(now.millis) + val podStateManager = AapsErosPodStateManager(aapsLogger, sp, rxBus) + podStateManager.initState(0x0) + podStateManager.setInitializationParameters( + 0, 0, FirmwareVersion(1, 1, 1), + FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS + ) + Assert.assertEquals(now, podStateManager.time) + Assert.assertEquals( + Duration.standardHours(1) + .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), + podStateManager.scheduleOffset + ) + } + + @Test fun changeSystemTimeZoneWithoutChangingPodTimeZone() { + val timeZone = DateTimeZone.UTC + DateTimeZone.setDefault(timeZone) + val now = DateTime(2020, 1, 1, 1, 2, 3, timeZone) + DateTimeUtils.setCurrentMillisFixed(now.millis) + val podStateManager = AapsErosPodStateManager(aapsLogger, sp, rxBus) + podStateManager.initState(0x0) + podStateManager.setInitializationParameters( + 0, 0, FirmwareVersion(1, 1, 1), + FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS + ) + val newTimeZone = DateTimeZone.forOffsetHours(2) + DateTimeZone.setDefault(newTimeZone) + + // The system time zone has been updated, but the pod session state's time zone hasn't + // So the pods time should not have been changed + Assert.assertEquals(now, podStateManager.time) + Assert.assertEquals( + Duration.standardHours(1) + .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), + podStateManager.scheduleOffset + ) + } + + @Test fun changeSystemTimeZoneAndChangePodTimeZone() { + val timeZone = DateTimeZone.UTC + DateTimeZone.setDefault(timeZone) + val now = DateTime(2020, 1, 1, 1, 2, 3, timeZone) + DateTimeUtils.setCurrentMillisFixed(now.millis) + val podStateManager = AapsErosPodStateManager(aapsLogger, sp, rxBus) + podStateManager.initState(0x0) + podStateManager.setInitializationParameters( + 0, 0, FirmwareVersion(1, 1, 1), + FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS + ) + val newTimeZone = DateTimeZone.forOffsetHours(2) + DateTimeZone.setDefault(newTimeZone) + podStateManager.timeZone = newTimeZone + + // Both the system time zone have been updated + // So the pods time should have been changed (to +2 hours) + Assert.assertEquals(now.withZone(newTimeZone), podStateManager.time) + Assert.assertEquals( + Duration.standardHours(3) + .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))), + podStateManager.scheduleOffset + ) + } + + @After fun tearDown() { + DateTimeUtils.setCurrentMillisSystem() + } +} \ No newline at end of file diff --git a/openhumans/build.gradle b/openhumans/build.gradle index e3b5a31fa9..5e06a3e587 100644 --- a/openhumans/build.gradle +++ b/openhumans/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/openhumans/src/main/res/values-fr-rFR/strings.xml b/openhumans/src/main/res/values-fr-rFR/strings.xml index afe3f76ece..6a121d0575 100644 --- a/openhumans/src/main/res/values-fr-rFR/strings.xml +++ b/openhumans/src/main/res/values-fr-rFR/strings.xml @@ -2,9 +2,18 @@ Open Humans OH + Open Humans vous permet de télécharger vos données sur le diabète et de les donner à des projets scientifiques. Déconnexion + Configuration + Open Humans a été configuré. Si vous souhaitez arrêter le téléchargement, cliquez sur «Déconnexion». + Open Humans est actuellement inactif. Pour commencer à télécharger des données, cliquez sur «Configuration». + ID utilisateur : %1$s Ne télécharger que si connecté au WiFi Ne télécharger que si en charge + Téléchargement vers Open Humans… + Notifications Open Humans + AndroidAPS télécharge vers Open Humans. Cela peut prendre un certain temps. Vous avez été déconnecté d\'Open Humans Cliquez ici pour vous connecter à nouveau si ce n\'était pas volontaire. + Télécharger maintenant diff --git a/openhumans/src/main/res/values-it-rIT/strings.xml b/openhumans/src/main/res/values-it-rIT/strings.xml index 05ed9c478b..6ef4309f8e 100644 --- a/openhumans/src/main/res/values-it-rIT/strings.xml +++ b/openhumans/src/main/res/values-it-rIT/strings.xml @@ -2,9 +2,18 @@ Open Humans OH + Open Humans ti permette di caricare i tuoi dati sul diabete e donarli a progetti scientifici. Logout + Configurazione + Open Humans è stato configurato. In caso tu voglia fermare il caricamento, fai click su \'Logout\'. + Open Humans è attualmente inattivo. Per avviare il caricamento dei dati, fai click su \'Configurazione\'. + Project Member ID: %1$s Upload solo se connesso a WiFi Upload solo se in carica + Caricamento su Open Humans… + Notifiche Open Humans + AndroidAPS sta caricando i dati su Open Humans. Potrebbe volerci un po\' di tempo. Sei stato disconnesso da Open Humans Fare click qui per accedere di nuovo. + Carica adesso diff --git a/openhumans/src/main/res/values-ru-rRU/strings.xml b/openhumans/src/main/res/values-ru-rRU/strings.xml index 478bd2c8c6..8827371bc6 100644 --- a/openhumans/src/main/res/values-ru-rRU/strings.xml +++ b/openhumans/src/main/res/values-ru-rRU/strings.xml @@ -2,9 +2,18 @@ Проект Open Humans OH + Open Humans позволяет загружать данные о диабете и вносить их в научные проекты. Выход + Настройки + Open Humans настроен. Чтобы прекратить передачу данных, нажмите \'Выйти\'. + Open Humans неактивна. Чтобы начать загрузку данных, нажмите \'Setup\'. + Идентификатор участника проекта: %1$s Загружать только при подключении к WiFi Загружать только при зарядке + Идет передача данных в Open Humans… + Уведомления Open Humans + AndroidAPS передает данные в Open Humans. Это может занять некоторое время. Вы вышли из Open Humans Нажмите здесь, чтобы снова войти в систему, если выход произошел случайно. + Начать передачу данных diff --git a/pump-common/build.gradle b/pump-common/build.gradle index 10a6c55b08..5457b18d34 100644 --- a/pump-common/build.gradle +++ b/pump-common/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/rileylink/build.gradle b/rileylink/build.gradle index edbb3c241d..3ea01781f9 100644 --- a/rileylink/build.gradle +++ b/rileylink/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' apply from: "${project.rootDir}/gradle/android_dependencies.gradle" diff --git a/rileylink/src/test/java/info/nightscout/androidaps/TestBase.kt b/rileylink/src/test/java/info/nightscout/androidaps/TestBase.kt new file mode 100644 index 0000000000..ff88739ba2 --- /dev/null +++ b/rileylink/src/test/java/info/nightscout/androidaps/TestBase.kt @@ -0,0 +1,39 @@ +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.* + +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/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.java b/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.java deleted file mode 100644 index 8afff65fa4..0000000000 --- a/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.powermock.modules.junit4.PowerMockRunner; - -import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion; - -import static org.junit.Assert.assertEquals; - -@RunWith(PowerMockRunner.class) -public class RFSpyTest { - @Mock - private AAPSLogger aapsLogger; - - @Test - public void testGetFirmwareVersion() { - assertEquals(RileyLinkFirmwareVersion.Version_1_0, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0")); - assertEquals(RileyLinkFirmwareVersion.Version_1_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1")); - assertEquals(RileyLinkFirmwareVersion.Version_1_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13")); - - assertEquals(RileyLinkFirmwareVersion.Version_2_0, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0")); - assertEquals(RileyLinkFirmwareVersion.Version_2_0, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1")); - assertEquals(RileyLinkFirmwareVersion.Version_2_2, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2")); - assertEquals(RileyLinkFirmwareVersion.Version_2_2, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16")); - assertEquals(RileyLinkFirmwareVersion.Version_2_2, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17")); - assertEquals(RileyLinkFirmwareVersion.Version_2_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3")); - assertEquals(RileyLinkFirmwareVersion.Version_2_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0")); - assertEquals(RileyLinkFirmwareVersion.Version_2_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17")); - - assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0")); - assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1")); - assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1")); - assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13")); - - assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0")); - assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4")); - assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3")); - assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7")); - - assertEquals(RileyLinkFirmwareVersion.UnknownVersion, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0")); - assertEquals(RileyLinkFirmwareVersion.UnknownVersion, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0")); - assertEquals(RileyLinkFirmwareVersion.UnknownVersion, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5")); - } -} \ No newline at end of file diff --git a/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt b/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt new file mode 100644 index 0000000000..bb2c050863 --- /dev/null +++ b/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt @@ -0,0 +1,100 @@ +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 + +class RFSpyTest : TestBase() { + + @Test fun testGetFirmwareVersion() { + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_1_0, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_1_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_1_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_0, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_0, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_2, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_2, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_2, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_2_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_3_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_3_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_3_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_3_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_4_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_4_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_4_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.Version_4_x, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.UnknownVersion, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.UnknownVersion, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0") + ) + Assert.assertEquals( + RileyLinkFirmwareVersion.UnknownVersion, + RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5") + ) + } +} \ No newline at end of file diff --git a/wear/build.gradle b/wear/build.gradle index b7152ebe07..c92e76a22b 100644 --- a/wear/build.gradle +++ b/wear/build.gradle @@ -12,6 +12,7 @@ buildscript { } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'kotlin-allopen' apply plugin: 'com.hiya.jacoco-android' jacoco { @@ -27,6 +28,7 @@ ext { wearableVersion = "2.8.1" // playServicesWearable 17.1.0 breaks test playServicesWearable = "17.0.0" + powermockVersion = '2.0.9' } def generateGitBuild = { -> diff --git a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java index 98b7f99297..123468bdf3 100644 --- a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java +++ b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java @@ -1,12 +1,5 @@ package info.nightscout.androidaps.interaction.utils; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.HashSet; -import java.util.Set; - import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -14,7 +7,11 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -@RunWith(PowerMockRunner.class) +import org.junit.Test; + +import java.util.HashSet; +import java.util.Set; + public class PairTest { @Test diff --git a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/SafeParseTest.java b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/SafeParseTest.java deleted file mode 100644 index 62a71e6420..0000000000 --- a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/SafeParseTest.java +++ /dev/null @@ -1,128 +0,0 @@ -package info.nightscout.androidaps.interaction.utils; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.modules.junit4.PowerMockRunner; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -/** - * Created by dlvoy on 21.11.2019. - */ -@RunWith(PowerMockRunner.class) -public class SafeParseTest { - - @Test - public void stringToDoubleTest() { - // correct values - assertThat(0.1234, is(SafeParse.stringToDouble("0.1234"))); - assertThat(0.1234, is(SafeParse.stringToDouble("0,1234"))); - assertThat(0.5436564812, is(SafeParse.stringToDouble(".5436564812"))); - assertThat(0.5436564812, is(SafeParse.stringToDouble(",5436564812"))); - assertThat(1000500100900.0, is(SafeParse.stringToDouble("1000500100900"))); - assertThat(42.0, is(SafeParse.stringToDouble("42"))); - - // units or other extra values are not permitted - assertThat(0.0, is(SafeParse.stringToDouble("12 U/h"))); - - // strings are not parsable - assertThat(0.0, is(SafeParse.stringToDouble("ala ma kota"))); - - // separator errors - assertThat(0.0, is(SafeParse.stringToDouble("0.1234.5678"))); - assertThat(0.0, is(SafeParse.stringToDouble("0,1234,5678"))); - - // various emptiness - assertThat(0.0, is(SafeParse.stringToDouble(""))); - assertThat(0.0, is(SafeParse.stringToDouble(" "))); - assertThat(0.0, is(SafeParse.stringToDouble("\n\r"))); - } - - @Test - public void stringToIntTest() { - // correct values - assertThat(1052934, is(SafeParse.stringToInt("1052934"))); - assertThat(-42, is(SafeParse.stringToInt("-42"))); - assertThat(2147483647, is(SafeParse.stringToInt("2147483647"))); - assertThat(-2147483648, is(SafeParse.stringToInt("-2147483648"))); - - // outside Integer range - assertThat(0, is(SafeParse.stringToInt("2147483648"))); - assertThat(0, is(SafeParse.stringToInt("-2147483649"))); - - // units or other extra values are not permitted - assertThat(0, is(SafeParse.stringToInt("12 U/h"))); - assertThat(0, is(SafeParse.stringToInt("0.1234"))); - assertThat(0, is(SafeParse.stringToInt("0,1234"))); - assertThat(0, is(SafeParse.stringToInt(".5436564812"))); - assertThat(0, is(SafeParse.stringToInt(",5436564812"))); - assertThat(0, is(SafeParse.stringToInt("42.1234"))); - assertThat(0, is(SafeParse.stringToInt("42,1234"))); - assertThat(0, is(SafeParse.stringToInt("3212.5436564812"))); - assertThat(0, is(SafeParse.stringToInt("3212,5436564812"))); - assertThat(0, is(SafeParse.stringToInt("1000500100900"))); - - // strings are not parsable - assertThat(0, is(SafeParse.stringToInt("ala ma kota"))); - - // various emptiness - assertThat(0, is(SafeParse.stringToInt(""))); - assertThat(0, is(SafeParse.stringToInt(" "))); - assertThat(0, is(SafeParse.stringToInt("\n\r"))); - } - - @Test - public void stringToLongTest() { - // correct values - assertThat(1052934L, is(SafeParse.stringToLong("1052934"))); - assertThat(-42L, is(SafeParse.stringToLong("-42"))); - assertThat(2147483647L, is(SafeParse.stringToLong("2147483647"))); - assertThat(-2147483648L, is(SafeParse.stringToLong("-2147483648"))); - assertThat(1000500100900L, is(SafeParse.stringToLong("1000500100900"))); - - // outside Integer range - assertThat(2147483648L, is(SafeParse.stringToLong("2147483648"))); - assertThat(-2147483649L, is(SafeParse.stringToLong("-2147483649"))); - - // units or other extra values are not permitted - assertThat(0L, is(SafeParse.stringToLong("12 U/h"))); - assertThat(0L, is(SafeParse.stringToLong("0.1234"))); - assertThat(0L, is(SafeParse.stringToLong("0,1234"))); - assertThat(0L, is(SafeParse.stringToLong(".5436564812"))); - assertThat(0L, is(SafeParse.stringToLong(",5436564812"))); - assertThat(0L, is(SafeParse.stringToLong("42.1234"))); - assertThat(0L, is(SafeParse.stringToLong("42,1234"))); - assertThat(0L, is(SafeParse.stringToLong("3212.5436564812"))); - assertThat(0L, is(SafeParse.stringToLong("3212,5436564812"))); - - // strings are not parsable - assertThat(0L, is(SafeParse.stringToLong("ala ma kota"))); - - // various emptiness - assertThat(0L, is(SafeParse.stringToLong(""))); - assertThat(0L, is(SafeParse.stringToLong(" "))); - assertThat(0L, is(SafeParse.stringToLong("\n\r"))); - } - - @Test(expected=NullPointerException.class) - public void stringToDoubleNullTest() { - SafeParse.stringToDouble(null); - } - - @Test(expected=NullPointerException.class) - public void stringToIntNullTest() { - SafeParse.stringToInt(null); - } - - @Test(expected=NullPointerException.class) - public void stringToLongNullTest() { - SafeParse.stringToLong(null); - } - - @Before - public void prepareMock() { - - } -} diff --git a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/SafeParseTest.kt b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/SafeParseTest.kt new file mode 100644 index 0000000000..be9a420b54 --- /dev/null +++ b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/SafeParseTest.kt @@ -0,0 +1,114 @@ +package info.nightscout.androidaps.interaction.utils + +import org.junit.Assert.assertEquals +import org.junit.Before +import org.junit.Test +import java.lang.NullPointerException + + +@Suppress("SpellCheckingInspection") +class SafeParseTest { + + @Test fun stringToDoubleTest() { + // correct values + assertEquals(0.1234, SafeParse.stringToDouble("0.1234"), 0.001) + assertEquals(0.1234, SafeParse.stringToDouble("0,1234"), 0.001) + assertEquals(0.5436564812, SafeParse.stringToDouble(".5436564812"), 0.001) + assertEquals(0.5436564812, SafeParse.stringToDouble(",5436564812"), 0.001) + assertEquals(1000500100900.0, SafeParse.stringToDouble("1000500100900"), 0.001) + assertEquals(42.0, SafeParse.stringToDouble("42"), 0.001) + + // units or other extra values are not permitted + assertEquals(0.0, SafeParse.stringToDouble("12 U/h"), 0.001) + + // strings are not parsable + assertEquals(0.0, SafeParse.stringToDouble("ala ma kota"), 0.001) + + // separator errors + assertEquals(0.0, SafeParse.stringToDouble("0.1234.5678"), 0.001) + assertEquals(0.0, SafeParse.stringToDouble("0,1234,5678"), 0.001) + + // various emptiness + assertEquals(0.0, SafeParse.stringToDouble(""), 0.001) + assertEquals(0.0, SafeParse.stringToDouble(" "), 0.001) + assertEquals(0.0, SafeParse.stringToDouble("\n\r"), 0.001) + } + + @Test fun stringToIntTest() { + // correct values + assertEquals(1052934, SafeParse.stringToInt("1052934")) + assertEquals(-42, SafeParse.stringToInt("-42")) + assertEquals(2147483647, SafeParse.stringToInt("2147483647")) + assertEquals(-2147483648, SafeParse.stringToInt("-2147483648")) + + // outside Integer range + assertEquals(0, SafeParse.stringToInt("2147483648")) + assertEquals(0, SafeParse.stringToInt("-2147483649")) + + // units or other extra values are not permitted + assertEquals(0, SafeParse.stringToInt("12 U/h")) + assertEquals(0, SafeParse.stringToInt("0.1234")) + assertEquals(0, SafeParse.stringToInt("0,1234")) + assertEquals(0, SafeParse.stringToInt(".5436564812")) + assertEquals(0, SafeParse.stringToInt(",5436564812")) + assertEquals(0, SafeParse.stringToInt("42.1234")) + assertEquals(0, SafeParse.stringToInt("42,1234")) + assertEquals(0, SafeParse.stringToInt("3212.5436564812")) + assertEquals(0, SafeParse.stringToInt("3212,5436564812")) + assertEquals(0, SafeParse.stringToInt("1000500100900")) + + // strings are not parsable + assertEquals(0, SafeParse.stringToInt("ala ma kota")) + + // various emptiness + assertEquals(0, SafeParse.stringToInt("")) + assertEquals(0, SafeParse.stringToInt(" ")) + assertEquals(0, SafeParse.stringToInt("\n\r")) + } + + @Test fun stringToLongTest() { + // correct values + assertEquals(1052934L, SafeParse.stringToLong("1052934")) + assertEquals(-42L, SafeParse.stringToLong("-42")) + assertEquals(2147483647L, SafeParse.stringToLong("2147483647")) + assertEquals(-2147483648L, SafeParse.stringToLong("-2147483648")) + assertEquals(1000500100900L, SafeParse.stringToLong("1000500100900")) + + // outside Integer range + assertEquals(2147483648L, SafeParse.stringToLong("2147483648")) + assertEquals(-2147483649L, SafeParse.stringToLong("-2147483649")) + + // units or other extra values are not permitted + assertEquals(0L, SafeParse.stringToLong("12 U/h")) + assertEquals(0L, SafeParse.stringToLong("0.1234")) + assertEquals(0L, SafeParse.stringToLong("0,1234")) + assertEquals(0L, SafeParse.stringToLong(".5436564812")) + assertEquals(0L, SafeParse.stringToLong(",5436564812")) + assertEquals(0L, SafeParse.stringToLong("42.1234")) + assertEquals(0L, SafeParse.stringToLong("42,1234")) + assertEquals(0L, SafeParse.stringToLong("3212.5436564812")) + assertEquals(0L, SafeParse.stringToLong("3212,5436564812")) + + // strings are not parsable + assertEquals(0L, SafeParse.stringToLong("ala ma kota")) + + // various emptiness + assertEquals(0L, SafeParse.stringToLong("")) + assertEquals(0L, SafeParse.stringToLong(" ")) + assertEquals(0L, SafeParse.stringToLong("\n\r")) + } + + @Test(expected = NullPointerException::class) fun stringToDoubleNullTest() { + SafeParse.stringToDouble(null) + } + + @Test(expected = NullPointerException::class) fun stringToIntNullTest() { + SafeParse.stringToInt(null) + } + + @Test(expected = NullPointerException::class) fun stringToLongNullTest() { + SafeParse.stringToLong(null) + } + + @Before fun prepareMock() {} +} \ No newline at end of file diff --git a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/AndroidMocker.java b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/AndroidMocker.java index a1addfdc1d..8010826d43 100644 --- a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/AndroidMocker.java +++ b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/AndroidMocker.java @@ -1,15 +1,14 @@ package info.nightscout.androidaps.testing.mockers; -import org.junit.Assert; -import org.powermock.api.mockito.PowerMockito; - -import java.util.Base64; - import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.powermock.api.mockito.PowerMockito.mockStatic; +import org.powermock.api.mockito.PowerMockito; + +import java.util.Base64; + public class AndroidMocker { public static void mockBase64() throws Exception { diff --git a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/LogMocker.java b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/LogMocker.java index 5c374665bc..0dccaafced 100644 --- a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/LogMocker.java +++ b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/LogMocker.java @@ -1,9 +1,9 @@ package info.nightscout.androidaps.testing.mockers; -import android.util.Log; - import static org.powermock.api.mockito.PowerMockito.mockStatic; +import android.util.Log; + public class LogMocker { public static void prepareMock() { mockStatic(Log.class); diff --git a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.java b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.java index 11a89f0699..e3f24e878e 100644 --- a/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.java +++ b/wear/src/test/java/info/nightscout/androidaps/testing/mockers/WearUtilMocker.java @@ -1,11 +1,15 @@ package info.nightscout.androidaps.testing.mockers; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; +import static org.powermock.api.mockito.PowerMockito.mockStatic; + import android.os.Bundle; import com.google.android.gms.wearable.Asset; import com.google.android.gms.wearable.DataMap; -import org.junit.Assert; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.powermock.api.mockito.PowerMockito; @@ -15,11 +19,6 @@ import java.util.ArrayList; import info.nightscout.androidaps.interaction.utils.Constants; import info.nightscout.androidaps.interaction.utils.WearUtil; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.powermock.api.mockito.PowerMockito.mockStatic; - public class WearUtilMocker { public static final long REF_NOW = 1572610530000L;