OpenForTesting cleanup

This commit is contained in:
Milos Kozak 2023-09-23 15:51:12 +02:00
parent 8c6157b8f6
commit a0b4fbcd21
60 changed files with 60 additions and 71 deletions

View file

@ -18,11 +18,6 @@ repositories {
google()
}
allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'info.nightscout.androidaps.annotations.OpenForTesting'
}
def generateGitBuild = { ->
StringBuilder stringBuilder = new StringBuilder()
try {

View file

@ -1,4 +1,4 @@
package info.nightscout.annotations
package app.aaps.annotations
/**
* This is the actual annotation that makes the class open. Don't use it directly, only through [OpenForTesting]

View file

@ -1,6 +1,6 @@
package info.nightscout.interfaces.plugin
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
@OpenForTesting
class PluginDescription {

View file

@ -1,4 +1,4 @@
package info.nightscout.annotations
package app.aaps.annotations
/**
* Annotate a class with [OpenForTesting] if it should be extendable for testing.

View file

@ -1,4 +1,4 @@
allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'info.nightscout.annotations.OpenForTesting'
annotation 'app.aaps.annotations.OpenForTesting'
}

View file

@ -1,11 +1,11 @@
package info.nightscout.core.utils.fabric
import android.os.Bundle
import app.aaps.annotations.OpenForTesting
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.firebase.ktx.Firebase
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.utils.R
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag

View file

@ -1,7 +1,7 @@
package info.nightscout.core.wizard
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.extensions.valueToUnits
import info.nightscout.core.iob.round
import info.nightscout.core.utils.JsonHelper.safeGetInt

View file

@ -51,8 +51,3 @@ dependencies {
androidTestImplementation "androidx.room:room-testing:$room_version"
}
allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'info.nightscout.database.annotations.DbOpenForTesting'
}

View file

@ -1,6 +1,6 @@
package info.nightscout.implementation
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.profile.DefaultValueHelper

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation
import android.content.Context
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.interfaces.ui.UiInteraction

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation
import app.aaps.annotations.OpenForTesting
import dagger.Reusable
import info.nightscout.annotations.OpenForTesting
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation.iob
import app.aaps.annotations.OpenForTesting
import dagger.Reusable
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.iob.asRounded
import info.nightscout.core.iob.log
import info.nightscout.interfaces.iob.GlucoseStatus

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation.logging
import app.aaps.annotations.OpenForTesting
import dagger.Reusable
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.logging.LoggerUtils
import info.nightscout.interfaces.maintenance.PrefFileListProvider
import javax.inject.Inject

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation.profiling
import app.aaps.annotations.OpenForTesting
import dagger.Reusable
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.profiling.Profiler
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag

View file

@ -1,8 +1,8 @@
package info.nightscout.implementation.pump
import app.aaps.annotations.OpenForTesting
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import info.nightscout.annotations.OpenForTesting
import info.nightscout.implementation.R
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.DetailedBolusInfoStorage

View file

@ -1,6 +1,6 @@
package info.nightscout.implementation.pump
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.TemporaryBasalStorage
import info.nightscout.rx.logging.AAPSLogger

View file

@ -7,8 +7,8 @@ import android.os.HandlerThread
import android.os.SystemClock
import android.text.Spanned
import androidx.appcompat.app.AppCompatActivity
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.constraints.ConstraintObject
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.extensions.getCustomizedName

View file

@ -2,7 +2,7 @@ package info.nightscout.implementation.receivers
import android.content.Context
import android.content.Intent
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventChargingState

View file

@ -12,8 +12,8 @@ import android.os.Handler
import android.os.HandlerThread
import android.os.SystemClock
import androidx.core.app.NotificationCompat
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.constraints.ConstraintObject
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.extensions.convertedToAbsolute

View file

@ -1,8 +1,8 @@
package info.nightscout.plugins.aps.openAPSAMA
import android.content.Context
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.constraints.ConstraintObject
import info.nightscout.core.extensions.target
import info.nightscout.core.utils.MidnightUtils

View file

@ -1,8 +1,8 @@
package info.nightscout.plugins.aps.openAPSSMBDynamicISF
import android.content.Context
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.aps.DetermineBasalAdapter
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck

View file

@ -1,6 +1,6 @@
package info.nightscout.plugins.general.autotune
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.interfaces.logging.LoggerUtils
import info.nightscout.plugins.general.autotune.data.ATProfile
import info.nightscout.plugins.general.autotune.data.PreppedGlucose

View file

@ -4,8 +4,8 @@ import android.content.Context
import android.os.Handler
import android.os.HandlerThread
import android.os.SystemClock
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.automation.actions.Action
import info.nightscout.automation.actions.ActionAlarm
import info.nightscout.automation.actions.ActionCarePortalEvent

View file

@ -1,7 +1,7 @@
package info.nightscout.automation.services
import android.location.Location
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import javax.inject.Inject
import javax.inject.Singleton

View file

@ -5,7 +5,7 @@ import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.os.IBinder
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.interfaces.NotificationHolder
import javax.inject.Inject
import javax.inject.Singleton

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.ui
import android.content.Context
import android.content.Intent
import android.provider.AlarmClock
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.automation.R
import info.nightscout.core.ui.toast.ToastUtils
import javax.inject.Inject

View file

@ -2,13 +2,13 @@ package app.aaps.configuration.maintenance
import android.content.Context
import android.os.Environment
import app.aaps.annotations.OpenForTesting
import app.aaps.configuration.R
import app.aaps.configuration.maintenance.data.PrefMetadataMap
import app.aaps.configuration.maintenance.data.PrefsStatusImpl
import app.aaps.configuration.maintenance.formats.EncryptedPrefsFormat
import dagger.Lazy
import dagger.Reusable
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.maintenance.PrefFileListProvider
import info.nightscout.interfaces.maintenance.PrefMetadata

View file

@ -2,8 +2,8 @@ package info.nightscout.plugins.constraints.storage
import android.os.Environment
import android.os.StatFs
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.PluginConstraints

View file

@ -9,8 +9,8 @@ import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.constraints.ConstraintObject
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.iob.generateCOBString

View file

@ -1,9 +1,9 @@
package info.nightscout.plugins.general.smsCommunicator.otp
import android.util.Base64
import app.aaps.annotations.OpenForTesting
import com.eatthepath.otp.HmacOneTimePasswordGenerator
import com.google.common.io.BaseEncoding
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.Constants
import info.nightscout.plugins.R
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -1,8 +1,8 @@
package info.nightscout.plugins.iob.iobCobCalculator
import androidx.collection.LongSparseArray
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.extensions.convertedToAbsolute
import info.nightscout.core.extensions.iobCalc
import info.nightscout.core.extensions.toTemporaryBasal

View file

@ -2,7 +2,7 @@ package info.nightscout.plugins.iob.iobCobCalculator.data
import androidx.collection.LongSparseArray
import androidx.collection.size
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.aps.AutosensData
import info.nightscout.interfaces.aps.AutosensDataStore

View file

@ -1,8 +1,8 @@
package info.nightscout.plugins.profile
import androidx.fragment.app.FragmentActivity
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.extensions.blockFromJsonArray
import info.nightscout.core.extensions.pureProfileFromJson
import info.nightscout.core.profile.ProfileSealed

View file

@ -1,7 +1,7 @@
package info.nightscout.sensitivity
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.utils.MidnightUtils
import info.nightscout.core.utils.Percentile
import info.nightscout.database.entities.TherapyEvent

View file

@ -1,7 +1,7 @@
package info.nightscout.sensitivity
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.utils.MidnightUtils
import info.nightscout.core.utils.Percentile
import info.nightscout.database.entities.TherapyEvent

View file

@ -1,8 +1,8 @@
package info.nightscout.sensitivity
import androidx.collection.LongSparseArray
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.utils.MidnightUtils
import info.nightscout.database.entities.TherapyEvent
import info.nightscout.database.impl.AppRepository

View file

@ -1,7 +1,7 @@
package info.nightscout.smoothing
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
import info.nightscout.interfaces.plugin.PluginBase

View file

@ -1,7 +1,7 @@
package info.nightscout.smoothing
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
import info.nightscout.interfaces.plugin.PluginBase

View file

@ -1,7 +1,7 @@
package info.nightscout.smoothing
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription

View file

@ -3,8 +3,8 @@ package info.nightscout.source
import android.content.Context
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.utils.worker.LoggingWorker
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.database.impl.AppRepository

View file

@ -1,6 +1,6 @@
package info.nightscout.plugins.sync.nsShared
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.core.utils.JsonHelper
import info.nightscout.database.entities.Food
import info.nightscout.database.entities.GlucoseValue

View file

@ -1,6 +1,6 @@
package info.nightscout.plugins.sync.nsclient
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.plugins.sync.R

View file

@ -1,6 +1,6 @@
package info.nightscout.plugins.sync.nsclient.data
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.core.utils.HtmlHelper
import info.nightscout.core.utils.JsonHelper
import info.nightscout.interfaces.Config

View file

@ -3,7 +3,7 @@
package info.nightscout.plugins.sync.nsclient.data
import android.content.Context
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.utils.JsonHelper
import info.nightscout.database.entities.UserEntry

View file

@ -1,6 +1,6 @@
package info.nightscout.plugins.sync.nsclientV3
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.core.utils.JsonHelper
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.Config

View file

@ -11,10 +11,10 @@ import androidx.work.ExistingWorkPolicy
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkInfo
import androidx.work.WorkManager
import app.aaps.annotations.OpenForTesting
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.database.ValueWrapper
import info.nightscout.database.entities.interfaces.TraceableDBEntry

View file

@ -2,7 +2,7 @@ package info.nightscout.plugins.sync.nsclientV3.workers
import android.content.Context
import androidx.work.WorkerParameters
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.core.utils.worker.LoggingWorker
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.plugins.sync.nsclientV3.DataSyncSelectorV3

View file

@ -2,7 +2,7 @@ package info.nightscout.plugins.sync.xdrip.workers
import android.content.Context
import androidx.work.WorkerParameters
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.core.utils.worker.LoggingWorker
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.plugins.sync.xdrip.DataSyncSelectorXdripImpl

View file

@ -5,11 +5,11 @@ import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.os.IBinder
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService
import info.nightscout.androidaps.danar.AbstractDanaRPlugin
import info.nightscout.androidaps.danar.R
import info.nightscout.annotations.OpenForTesting
import info.nightscout.core.constraints.ConstraintObject
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.constraints.ConstraintsChecker

View file

@ -11,11 +11,11 @@ import androidx.annotation.NonNull;
import javax.inject.Inject;
import javax.inject.Singleton;
import app.aaps.annotations.OpenForTesting;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.danaRv2.services.DanaRv2ExecutionService;
import info.nightscout.androidaps.danar.AbstractDanaRPlugin;
import info.nightscout.androidaps.danar.R;
import info.nightscout.annotations.OpenForTesting;
import info.nightscout.core.constraints.ConstraintObject;
import info.nightscout.core.utils.fabric.FabricPrivacy;
import info.nightscout.interfaces.constraints.ConstraintsChecker;

View file

@ -11,9 +11,9 @@ import androidx.annotation.NonNull;
import javax.inject.Inject;
import javax.inject.Singleton;
import app.aaps.annotations.OpenForTesting;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.danar.services.DanaRExecutionService;
import info.nightscout.annotations.OpenForTesting;
import info.nightscout.core.constraints.ConstraintObject;
import info.nightscout.core.utils.fabric.FabricPrivacy;
import info.nightscout.interfaces.constraints.ConstraintsChecker;

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.medtronic.driver
import app.aaps.annotations.OpenForTesting
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem
@ -8,7 +9,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.pump.common.data.PumpStatus
import info.nightscout.pump.common.defs.PumpDeviceState

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import java.security.SecureRandom
@OpenForTesting

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util
import app.aaps.annotations.OpenForTesting
import com.google.crypto.tink.subtle.X25519
import info.nightscout.annotations.OpenForTesting
@OpenForTesting
class X25519KeyGenerator {

View file

@ -1,13 +1,12 @@
package info.nightscout.pump.common.sync
import app.aaps.annotations.OpenForTesting
import com.thoughtworks.xstream.XStream
import com.thoughtworks.xstream.security.AnyTypePermission
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
import javax.inject.Inject
import javax.inject.Singleton

View file

@ -1,6 +1,6 @@
package app.aaps.shared.impl.rx.bus
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.Event

View file

@ -4,7 +4,7 @@ import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.collection.LongSparseArray
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.interfaces.R
import info.nightscout.shared.SafeParse
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -1,7 +1,7 @@
package app.aaps.shared.tests
import app.aaps.annotations.OpenForTesting
import dagger.android.HasAndroidInjector
import info.nightscout.annotations.OpenForTesting
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump

View file

@ -1,6 +1,6 @@
package info.nightscout.androidaps.interaction.utils
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.rx.weardata.EventData

View file

@ -2,12 +2,12 @@ package info.nightscout.androidaps.interaction.utils
import android.content.Context
import android.os.PowerManager
import info.nightscout.annotations.OpenForTesting
import app.aaps.annotations.OpenForTesting
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import kotlinx.datetime.Clock
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.datetime.Clock
/**
* Created by andy on 3/5/19.