diff --git a/plugins/main/build.gradle b/plugins/main/build.gradle index fc8e25f88d..6f92e4b359 100644 --- a/plugins/main/build.gradle +++ b/plugins/main/build.gradle @@ -28,6 +28,7 @@ dependencies { implementation project(':core:validators') testImplementation project(':implementation') + testImplementation project(':plugins:insulin') api "androidx.appcompat:appcompat:$appcompat_version" api "com.google.android.material:material:$material_version" diff --git a/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index ef46cbe7e0..fa210907ca 100644 --- a/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/plugins/main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -13,8 +13,10 @@ import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileStore +import info.nightscout.interfaces.utils.HardLimits import info.nightscout.rx.bus.RxBus import info.nightscout.shared.interfaces.ResourceHelper +import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import org.json.JSONObject import org.junit.jupiter.api.BeforeEach @@ -36,8 +38,10 @@ open class TestBaseWithProfile : TestBase() { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var config: Config @Mock lateinit var context: Context + @Mock lateinit var sp: SP lateinit var dateUtil: DateUtil + lateinit var hardLimits: HardLimits val rxBus = RxBus(aapsSchedulers, aapsLogger) val profileInjector = HasAndroidInjector { AndroidInjector { } } @@ -55,6 +59,7 @@ open class TestBaseWithProfile : TestBase() { "\"target_high\":[{\"time\":\"00:00\",\"value\":\"7\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}" dateUtil = Mockito.spy(DateUtil(context)) `when`(dateUtil.now()).thenReturn(1656358822000) + hardLimits = HardLimitsMock(sp, rh) validProfile = ProfileSealed.Pure(pureProfileFromJson(JSONObject(validProfileJSON), dateUtil)!!) effectiveProfileSwitch = EffectiveProfileSwitch( timestamp = dateUtil.now(), diff --git a/plugins/insulin/src/test/java/info/nightscout/core/extensions/BolusExtensionKtTest.kt b/plugins/main/src/test/java/info/nightscout/core/extensions/BolusExtensionKtTest.kt similarity index 100% rename from plugins/insulin/src/test/java/info/nightscout/core/extensions/BolusExtensionKtTest.kt rename to plugins/main/src/test/java/info/nightscout/core/extensions/BolusExtensionKtTest.kt diff --git a/plugins/insulin/src/test/java/info/nightscout/core/extensions/ExtendedBolusExtensionKtTest.kt b/plugins/main/src/test/java/info/nightscout/core/extensions/ExtendedBolusExtensionKtTest.kt similarity index 100% rename from plugins/insulin/src/test/java/info/nightscout/core/extensions/ExtendedBolusExtensionKtTest.kt rename to plugins/main/src/test/java/info/nightscout/core/extensions/ExtendedBolusExtensionKtTest.kt diff --git a/plugins/insulin/src/test/java/info/nightscout/core/extensions/GlucoseValueExtensionKtTest.kt b/plugins/main/src/test/java/info/nightscout/core/extensions/GlucoseValueExtensionKtTest.kt similarity index 100% rename from plugins/insulin/src/test/java/info/nightscout/core/extensions/GlucoseValueExtensionKtTest.kt rename to plugins/main/src/test/java/info/nightscout/core/extensions/GlucoseValueExtensionKtTest.kt diff --git a/plugins/insulin/src/test/java/info/nightscout/core/extensions/TemporaryBasalExtensionKtTest.kt b/plugins/main/src/test/java/info/nightscout/core/extensions/TemporaryBasalExtensionKtTest.kt similarity index 100% rename from plugins/insulin/src/test/java/info/nightscout/core/extensions/TemporaryBasalExtensionKtTest.kt rename to plugins/main/src/test/java/info/nightscout/core/extensions/TemporaryBasalExtensionKtTest.kt diff --git a/plugins/insulin/src/test/java/info/nightscout/core/extensions/TemporaryTargetExtensionKtTest.kt b/plugins/main/src/test/java/info/nightscout/core/extensions/TemporaryTargetExtensionKtTest.kt similarity index 100% rename from plugins/insulin/src/test/java/info/nightscout/core/extensions/TemporaryTargetExtensionKtTest.kt rename to plugins/main/src/test/java/info/nightscout/core/extensions/TemporaryTargetExtensionKtTest.kt diff --git a/plugins/insulin/src/test/java/info/nightscout/core/extensions/TherapyEventExtensionKtTest.kt b/plugins/main/src/test/java/info/nightscout/core/extensions/TherapyEventExtensionKtTest.kt similarity index 100% rename from plugins/insulin/src/test/java/info/nightscout/core/extensions/TherapyEventExtensionKtTest.kt rename to plugins/main/src/test/java/info/nightscout/core/extensions/TherapyEventExtensionKtTest.kt diff --git a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt index 5b2709303f..0306e1734f 100644 --- a/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt +++ b/plugins/main/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt @@ -11,8 +11,8 @@ import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAny import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction import info.nightscout.database.impl.transactions.Transaction -import info.nightscout.interfaces.ApsMode import info.nightscout.implementation.iob.GlucoseStatusProviderImpl +import info.nightscout.interfaces.ApsMode import info.nightscout.interfaces.Constants import info.nightscout.interfaces.GlucoseUnit import info.nightscout.interfaces.XDripBroadcast @@ -36,7 +36,6 @@ import info.nightscout.interfaces.smsCommunicator.Sms import info.nightscout.plugins.R import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePassword import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePasswordValidationResult -import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T import io.reactivex.rxjava3.core.Single @@ -54,7 +53,6 @@ import org.mockito.invocation.InvocationOnMock @Suppress("SpellCheckingInspection") class SmsCommunicatorPluginTest : TestBaseWithProfile() { - @Mock lateinit var sp: SP @Mock lateinit var constraintChecker: Constraints @Mock lateinit var activePlugin: ActivePlugin @Mock lateinit var commandQueue: CommandQueue