remove PowerMock from all modules except wear

This commit is contained in:
Milos Kozak 2021-09-23 17:35:55 +02:00
parent b40428c986
commit b2c45d0a26
192 changed files with 714 additions and 1216 deletions

View file

@ -66,6 +66,7 @@ class SmsCommunicatorPlugin @Inject constructor(
injector: HasAndroidInjector, injector: HasAndroidInjector,
aapsLogger: AAPSLogger, aapsLogger: AAPSLogger,
resourceHelper: ResourceHelper, resourceHelper: ResourceHelper,
private val smsManager: SmsManager,
private val aapsSchedulers: AapsSchedulers, private val aapsSchedulers: AapsSchedulers,
private val sp: SP, private val sp: SP,
private val constraintChecker: ConstraintChecker, private val constraintChecker: ConstraintChecker,
@ -1090,7 +1091,6 @@ class SmsCommunicatorPlugin @Inject constructor(
} }
fun sendSMS(sms: Sms): Boolean { fun sendSMS(sms: Sms): Boolean {
val smsManager = SmsManager.getDefault()
sms.text = stripAccents(sms.text) sms.text = stripAccents(sms.text)
try { try {
aapsLogger.debug(LTag.SMS, "Sending SMS to " + sms.phoneNumber + ": " + sms.text) aapsLogger.debug(LTag.SMS, "Sending SMS to " + sms.phoneNumber + ": " + sms.text)

View file

@ -7,7 +7,11 @@ import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.database.embedments.InsulinConfiguration import info.nightscout.androidaps.database.embedments.InsulinConfiguration
import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
import info.nightscout.androidaps.extensions.pureProfileFromJson 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.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
@ -15,10 +19,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject import org.json.JSONObject
import org.junit.Before import org.junit.Before
import org.mockito.Mock import org.mockito.Mock
import org.powermock.core.classloader.annotations.PrepareForTest
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@PrepareForTest(FabricPrivacy::class)
open class TestBaseWithProfile : TestBase() { open class TestBaseWithProfile : TestBase() {
@Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var activePluginProvider: ActivePlugin

View file

@ -4,7 +4,6 @@ import android.app.NotificationManager
import android.content.Context import android.content.Context
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.database.AppRepository 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.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy 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.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` 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() { class LoopPluginTest : TestBase() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP

View file

@ -11,13 +11,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock 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() { class ConfigBuilderPluginTest : TestBase() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP

View file

@ -39,31 +39,31 @@ class DstHelperPluginTest : TestBase() {
var cal = Calendar.getInstance(tz, Locale.ITALIAN) var cal = Calendar.getInstance(tz, Locale.ITALIAN)
val df: DateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ITALIAN) val df: DateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ITALIAN)
var dateBeforeDST = df.parse("2018-03-25 01:55") var dateBeforeDST = df.parse("2018-03-25 01:55")
cal.time = dateBeforeDST cal.time = dateBeforeDST!!
Assert.assertEquals(false, plugin.wasDST(cal)) Assert.assertEquals(false, plugin.wasDST(cal))
Assert.assertEquals(true, plugin.willBeDST(cal)) Assert.assertEquals(true, plugin.willBeDST(cal))
TimeZone.setDefault(tz) TimeZone.setDefault(tz)
cal = Calendar.getInstance(tz, Locale.ITALIAN) cal = Calendar.getInstance(tz, Locale.ITALIAN)
dateBeforeDST = df.parse("2018-03-25 03:05") dateBeforeDST = df.parse("2018-03-25 03:05")
cal.time = dateBeforeDST cal.time = dateBeforeDST!!
Assert.assertEquals(true, plugin.wasDST(cal)) Assert.assertEquals(true, plugin.wasDST(cal))
Assert.assertEquals(false, plugin.willBeDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal))
TimeZone.setDefault(tz) TimeZone.setDefault(tz)
cal = Calendar.getInstance(tz, Locale.ITALIAN) cal = Calendar.getInstance(tz, Locale.ITALIAN)
dateBeforeDST = df.parse("2018-03-25 02:05") //Cannot happen!!! dateBeforeDST = df.parse("2018-03-25 02:05") //Cannot happen!!!
cal.time = dateBeforeDST cal.time = dateBeforeDST!!
Assert.assertEquals(true, plugin.wasDST(cal)) Assert.assertEquals(true, plugin.wasDST(cal))
Assert.assertEquals(false, plugin.willBeDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal))
TimeZone.setDefault(tz) TimeZone.setDefault(tz)
cal = Calendar.getInstance(tz, Locale.ITALIAN) cal = Calendar.getInstance(tz, Locale.ITALIAN)
dateBeforeDST = df.parse("2018-03-25 05:55") //Cannot happen!!! dateBeforeDST = df.parse("2018-03-25 05:55") //Cannot happen!!!
cal.time = dateBeforeDST cal.time = dateBeforeDST!!
Assert.assertEquals(true, plugin.wasDST(cal)) Assert.assertEquals(true, plugin.wasDST(cal))
Assert.assertEquals(false, plugin.willBeDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal))
TimeZone.setDefault(tz) TimeZone.setDefault(tz)
cal = Calendar.getInstance(tz, Locale.ITALIAN) cal = Calendar.getInstance(tz, Locale.ITALIAN)
dateBeforeDST = df.parse("2018-03-25 06:05") //Cannot happen!!! 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.wasDST(cal))
Assert.assertEquals(false, plugin.willBeDST(cal)) Assert.assertEquals(false, plugin.willBeDST(cal))
} }

View file

@ -1,5 +1,3 @@
@file:Suppress("SpellCheckingInspection")
package info.nightscout.androidaps.plugins.general.smsCommunicator package info.nightscout.androidaps.plugins.general.smsCommunicator
import android.telephony.SmsManager 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.common.defs.PumpType
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.queue.CommandQueue
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.XdripCalibrations import info.nightscout.androidaps.utils.XdripCalibrations
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
@ -40,25 +36,15 @@ import io.reactivex.Single
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.mockito.Mockito.anyLong import org.mockito.Mockito.anyLong
import org.mockito.invocation.InvocationOnMock 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.* import java.util.*
// Powermock needed to mock SmsManager @Suppress("SpellCheckingInspection")
@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)
class SmsCommunicatorPluginTest : TestBaseWithProfile() { class SmsCommunicatorPluginTest : TestBaseWithProfile() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP
@ -74,6 +60,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
@Mock lateinit var repository: AppRepository @Mock lateinit var repository: AppRepository
@Mock lateinit var dateUtilMocked: DateUtil @Mock lateinit var dateUtilMocked: DateUtil
@Mock lateinit var autosensDataStore: AutosensDataStore @Mock lateinit var autosensDataStore: AutosensDataStore
@Mock lateinit var smsManager: SmsManager
var injector: HasAndroidInjector = HasAndroidInjector { var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
@ -103,9 +90,6 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
`when`(iobCobCalculator.ads).thenReturn(autosensDataStore) `when`(iobCobCalculator.ads).thenReturn(autosensDataStore)
`when`(autosensDataStore.lastBg()).thenReturn(reading) `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`(sp.getString(R.string.key_smscommunicator_allowednumbers, "")).thenReturn("1234;5678")
`when`( `when`(
@ -114,7 +98,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
})) }))
val glucoseStatusProvider = GlucoseStatusProvider(aapsLogger = aapsLogger, iobCobCalculator = iobCobCalculator, dateUtil = dateUtilMocked) 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) smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true)
Mockito.doAnswer { invocation: InvocationOnMock -> Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(1) val callback = invocation.getArgument<Callback>(1)

View file

@ -4,14 +4,15 @@ import android.telephony.SmsMessage
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.powermock.api.mockito.PowerMockito import org.mockito.Mockito
import org.mockito.Mockito.`when`
class SmsTest : TestBase() { class SmsTest : TestBase() {
@Test fun doTests() { @Test fun doTests() {
val smsMessage = PowerMockito.mock(SmsMessage::class.java) val smsMessage = Mockito.mock(SmsMessage::class.java)
PowerMockito.`when`(smsMessage.originatingAddress).thenReturn("aNumber") `when`(smsMessage.originatingAddress).thenReturn("aNumber")
PowerMockito.`when`(smsMessage.messageBody).thenReturn("aBody") `when`(smsMessage.messageBody).thenReturn("aBody")
var sms = Sms(smsMessage) var sms = Sms(smsMessage)
Assert.assertEquals(sms.phoneNumber, "aNumber") Assert.assertEquals(sms.phoneNumber, "aNumber")
Assert.assertEquals(sms.text, "aBody") Assert.assertEquals(sms.text, "aBody")

View file

@ -5,10 +5,7 @@ import info.nightscout.androidaps.plugins.general.tidepool.messages.DatasetReply
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull import org.junit.Assert.assertNull
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class SessionTest { class SessionTest {
@Test @Test
fun populateBody() { fun populateBody() {

View file

@ -13,11 +13,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class AbstractSensitivityPluginTest : TestBase() { class AbstractSensitivityPluginTest : TestBase() {
@Mock lateinit var pluginDescription: PluginDescription @Mock lateinit var pluginDescription: PluginDescription

View file

@ -8,11 +8,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MM640GPluginTest : TestBase() { class MM640GPluginTest : TestBase() {
private lateinit var mM640gPlugin: MM640gPlugin private lateinit var mM640gPlugin: MM640gPlugin

View file

@ -1,18 +1,15 @@
package info.nightscout.androidaps.plugins.source package info.nightscout.androidaps.plugins.source
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class NSClientPluginTest : TestBase() { class NSClientPluginTest : TestBase() {
private lateinit var nsClientSourcePlugin: NSClientSourcePlugin private lateinit var nsClientSourcePlugin: NSClientSourcePlugin

View file

@ -4,17 +4,11 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@RunWith(PowerMockRunner::class)
@PrepareForTest(FabricPrivacy::class, AppRepository::class)
class TreatmentsPluginTest : TestBaseWithProfile() { class TreatmentsPluginTest : TestBaseWithProfile() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP

View file

@ -19,11 +19,9 @@ import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider 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.queue.commands.*
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy 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.BuildHelper
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
@ -33,19 +31,11 @@ import io.reactivex.Single
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.mockito.Mockito.anyLong import org.mockito.Mockito.anyLong
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner
import java.util.* 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() { class CommandQueueTest : TestBaseWithProfile() {
@Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var constraintChecker: ConstraintChecker

View file

@ -12,29 +12,18 @@ import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider 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.Command
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute 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.BuildHelper
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito 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() { class QueueThreadTest : TestBaseWithProfile() {
@Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var constraintChecker: ConstraintChecker

View file

@ -3,14 +3,8 @@ package info.nightscout.androidaps.utils
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock 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() { class SntpClientTest : TestBase() {
@Mock lateinit var dateUtil: DateUtil @Mock lateinit var dateUtil: DateUtil

View file

@ -17,16 +17,11 @@ import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.mockito.invocation.InvocationOnMock 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() { class BolusWizardTest : TestBase() {
private val pumpBolusStep = 0.1 private val pumpBolusStep = 0.1

View file

@ -14,11 +14,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class AutomationEventTest : TestBase() { class AutomationEventTest : TestBase() {
@Mock lateinit var loopPlugin: Loop @Mock lateinit var loopPlugin: Loop
@ -48,7 +45,6 @@ class AutomationEventTest : TestBase() {
val event = AutomationEvent(injector) val event = AutomationEvent(injector)
event.title = "Test" event.title = "Test"
event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest.oneItem)) event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest.oneItem))
?: throw Exception()
event.addAction(ActionLoopEnable(injector)) event.addAction(ActionLoopEnable(injector))
// export to json // export to json

View file

@ -8,12 +8,7 @@ import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerCon
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy
import org.junit.Assert import org.junit.Assert
import org.junit.Test 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() { class ComposeTriggerTest : TestBase() {
var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } } var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } }

View file

@ -19,10 +19,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject import org.json.JSONObject
import org.junit.Before import org.junit.Before
import org.mockito.Mock import org.mockito.Mock
import org.powermock.core.classloader.annotations.PrepareForTest
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@PrepareForTest(FabricPrivacy::class, AppRepository::class)
open class TestBaseWithProfile : TestBase() { open class TestBaseWithProfile : TestBase() {
@Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var activePluginProvider: ActivePlugin

View file

@ -15,15 +15,10 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` 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() { class ActionAlarmTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper

View file

@ -1,20 +1,15 @@
package info.nightscout.androidaps.plugins.general.automation.actions package info.nightscout.androidaps.plugins.general.automation.actions
import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.eq import org.mockito.ArgumentMatchers.eq
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionLoopDisableTest : ActionsTestBase() { class ActionLoopDisableTest : ActionsTestBase() {
lateinit var sut: ActionLoopDisable lateinit var sut: ActionLoopDisable

View file

@ -1,18 +1,14 @@
package info.nightscout.androidaps.plugins.general.automation.actions package info.nightscout.androidaps.plugins.general.automation.actions
import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionLoopEnableTest : ActionsTestBase() { class ActionLoopEnableTest : ActionsTestBase() {
lateinit var sut: ActionLoopEnable lateinit var sut: ActionLoopEnable

View file

@ -6,13 +6,10 @@ import info.nightscout.androidaps.queue.Callback
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionLoopSuspendTest : ActionsTestBase() { class ActionLoopSuspendTest : ActionsTestBase() {
lateinit var sut: ActionLoopSuspend lateinit var sut: ActionLoopSuspend

View file

@ -7,12 +7,9 @@ import info.nightscout.androidaps.queue.Callback
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionProfileSwitchPercentTest : ActionsTestBase() { class ActionProfileSwitchPercentTest : ActionsTestBase() {
private lateinit var sut: ActionProfileSwitchPercent private lateinit var sut: ActionProfileSwitchPercent

View file

@ -6,16 +6,13 @@ import info.nightscout.androidaps.queue.Callback
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.ArgumentMatchers.anyLong import org.mockito.ArgumentMatchers.anyLong
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.mockito.Mockito.anyInt import org.mockito.Mockito.anyInt
import org.mockito.Mockito.anyString import org.mockito.Mockito.anyString
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionProfileSwitchTest : ActionsTestBase() { class ActionProfileSwitchTest : ActionsTestBase() {
private lateinit var sut: ActionProfileSwitch private lateinit var sut: ActionProfileSwitch

View file

@ -6,13 +6,10 @@ import info.nightscout.androidaps.queue.Callback
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.anyString import org.mockito.ArgumentMatchers.anyString
import org.mockito.ArgumentMatchers.eq import org.mockito.ArgumentMatchers.eq
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionSendSMSTest : ActionsTestBase() { class ActionSendSMSTest : ActionsTestBase() {
private lateinit var sut: ActionSendSMS private lateinit var sut: ActionSendSMS

View file

@ -12,12 +12,9 @@ import io.reactivex.Single
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionStartTempTargetTest : ActionsTestBase() { class ActionStartTempTargetTest : ActionsTestBase() {
private lateinit var sut: ActionStartTempTarget private lateinit var sut: ActionStartTempTarget

View file

@ -9,12 +9,9 @@ import io.reactivex.Single
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class ActionStopTempTargetTest : ActionsTestBase() { class ActionStopTempTargetTest : ActionsTestBase() {
private lateinit var sut: ActionStopTempTarget private lateinit var sut: ActionStopTempTarget

View file

@ -3,12 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.actions
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Test 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() { class ActionTest : ActionsTestBase() {
@Test @Test

View file

@ -9,7 +9,6 @@ import info.nightscout.androidaps.database.entities.OfflineEvent
import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.UserEntryLogger 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.TestBaseWithProfile
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
@ -17,9 +16,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Before import org.junit.Before
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` 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 ActionsTestBase : TestBaseWithProfile() {
open class TestLoopPlugin( open class TestLoopPlugin(
@ -36,7 +33,7 @@ open class ActionsTestBase : TestBaseWithProfile() {
override val isSuspended: Boolean = suspended override val isSuspended: Boolean = suspended
override var enabled: Boolean override var enabled: Boolean
get() = true get() = true
set(value) {} set(_) {}
override fun minutesToEndOfSuspend(): Int = 0 override fun minutesToEndOfSuspend(): Int = 0

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class InputProfileNameTest : TriggerTestBase() { class InputProfileNameTest : TriggerTestBase() {
@Test fun setValue() { @Test fun setValue() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.general.automation.elements
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class LabelWithElementTest : TriggerTestBase() { class LabelWithElementTest : TriggerTestBase() {
@Test @Test

View file

@ -5,10 +5,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class LayoutBuilderTest : TestBase() { class LayoutBuilderTest : TestBase() {
val injector = HasAndroidInjector { AndroidInjector { } } val injector = HasAndroidInjector { AndroidInjector { } }

View file

@ -5,11 +5,8 @@ import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDum
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTestBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class StaticLabelTest : TriggerTestBase() { class StaticLabelTest : TriggerTestBase() {
@Test fun constructor() { @Test fun constructor() {

View file

@ -4,20 +4,14 @@ import com.google.common.base.Optional
import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.androidaps.utils.DateUtil
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` 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 TriggerAutosensValueTest : TriggerTestBase() { class TriggerAutosensValueTest : TriggerTestBase() {
var now = 1514766900000L var now = 1514766900000L

View file

@ -6,11 +6,8 @@ import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@RunWith(PowerMockRunner::class)
class TriggerBTDeviceTest : TriggerTestBase() { class TriggerBTDeviceTest : TriggerTestBase() {
var now = 1514766900000L var now = 1514766900000L

View file

@ -4,10 +4,7 @@ import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class TriggerConnectorTest : TriggerTestBase() { class TriggerConnectorTest : TriggerTestBase() {
@Test fun testTriggerList() { @Test fun testTriggerList() {

View file

@ -4,19 +4,13 @@ import com.google.common.base.Optional
import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.data.IobTotal import info.nightscout.androidaps.data.IobTotal
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
import info.nightscout.androidaps.utils.DateUtil
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mockito.`when` 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() { class TriggerIobTest : TriggerTestBase() {
var now = 1514766900000L var now = 1514766900000L

View file

@ -2,20 +2,14 @@ package info.nightscout.androidaps.plugins.general.automation.triggers
import com.google.common.base.Optional import com.google.common.base.Optional
import info.nightscout.androidaps.automation.R import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.T
import org.json.JSONException import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` 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 TriggerTimeTest : TriggerTestBase() { class TriggerTimeTest : TriggerTestBase() {
var now = 1514766900000L var now = 1514766900000L

View file

@ -21,16 +21,15 @@ buildscript {
preferencektx_version = '1.1.1' preferencektx_version = '1.1.1'
commonslang3_version = '3.11' commonslang3_version = '3.11'
commonscodec_version = '1.15' commonscodec_version = '1.15'
jodatime_version = '2.10.10' jodatime_version = '2.10.11'
work_version = '2.5.0' work_version = '2.5.0'
junit_version = '4.13.2' junit_version = '4.13.2'
mockitoVersion = '3.12.4' mockitoVersion = '3.12.4'
powermockVersion = '2.0.9'
dexmakerVersion = "1.2" dexmakerVersion = "1.2"
retrofit2Version = '2.9.0' retrofit2Version = '2.9.0'
okhttp3Version = '4.9.0' okhttp3Version = '4.9.0'
byteBuddyVersion = '1.11.16' byteBuddyVersion = '1.11.18'
androidx_junit = '1.1.2' androidx_junit = '1.1.2'
androidx_rules = '1.4.0-alpha04' androidx_rules = '1.4.0-alpha04'

View file

@ -15,14 +15,9 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` 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() { class ComboPluginTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.di package info.nightscout.androidaps.di
import android.content.Context import android.content.Context
import android.telephony.SmsManager
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
@ -32,4 +33,7 @@ open class CoreModule {
@Singleton @Singleton
fun provideAAPSLogger(l: L): AAPSLogger = AAPSLoggerProduction(l) fun provideAAPSLogger(l: L): AAPSLogger = AAPSLoggerProduction(l)
@Provides
fun smsManager() : SmsManager = SmsManager.getDefault()
} }

View file

@ -17,10 +17,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject import org.json.JSONObject
import org.junit.Before import org.junit.Before
import org.mockito.Mock import org.mockito.Mock
import org.powermock.core.classloader.annotations.PrepareForTest
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@PrepareForTest(FabricPrivacy::class)
open class TestBaseWithProfile : TestBase() { open class TestBaseWithProfile : TestBase() {
@Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var activePluginProvider: ActivePlugin

View file

@ -2,19 +2,13 @@ package info.nightscout.androidaps.data
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test 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. * Created by mike on 19.03.2018.
*/ */
@RunWith(PowerMockRunner::class)
@PrepareForTest(SP::class)
class ConstraintTest : TestBase() { class ConstraintTest : TestBase() {
@Test fun doTests() { @Test fun doTests() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.data
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class IobTest { class IobTest {
@Test fun plusTest() { @Test fun plusTest() {

View file

@ -1,17 +1,15 @@
package info.nightscout.androidaps.data package info.nightscout.androidaps.data
import android.content.Context import android.content.Context
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@RunWith(PowerMockRunner::class) class IobTotalTest : TestBase() {
class IobTotalTest {
@Mock lateinit var context: Context @Mock lateinit var context: Context

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.data
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MealDataTest { class MealDataTest {
@Test fun canCreateObject() { @Test fun canCreateObject() {

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.data package info.nightscout.androidaps.data
import android.text.Html
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
@ -9,14 +8,9 @@ import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner
import org.skyscreamer.jsonassert.JSONAssert import org.skyscreamer.jsonassert.JSONAssert
@RunWith(PowerMockRunner::class)
@PrepareForTest(Html::class)
class PumpEnactResultTest : TestBaseWithProfile() { class PumpEnactResultTest : TestBaseWithProfile() {
val injector = HasAndroidInjector { val injector = HasAndroidInjector {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.interfaces
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class PluginDescriptionTest { class PluginDescriptionTest {
@Test fun mainTypeTest() { @Test fun mainTypeTest() {

View file

@ -14,15 +14,10 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` 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() { class APSResultTest : TestBaseWithProfile() {
@Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var constraintChecker: ConstraintChecker

View file

@ -5,15 +5,10 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner
import java.io.File import java.io.File
@RunWith(PowerMockRunner::class)
@PrepareForTest(File::class, UserEntryPresentationHelper::class)
class ClassicPrefsFormatTest : TestBase() { class ClassicPrefsFormatTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper

View file

@ -9,19 +9,12 @@ import org.junit.Assert
import org.junit.Assume import org.junit.Assume
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito 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 import java.io.File
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@PowerMockIgnore("javax.crypto.*")
@RunWith(PowerMockRunner::class)
@PrepareForTest(File::class)
class EncryptedPrefsFormatTest : TestBase() { class EncryptedPrefsFormatTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper

View file

@ -6,9 +6,6 @@ import org.hamcrest.CoreMatchers.not
import org.junit.Assert import org.junit.Assert
import org.junit.Assume.assumeThat import org.junit.Assume.assumeThat
import org.junit.Test 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/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 // 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") @Suppress("SpellCheckingInspection")
@PowerMockIgnore("javax.crypto.*")
@RunWith(PowerMockRunner::class)
class CryptoUtilTest : TestBase() { class CryptoUtilTest : TestBase() {
private var cryptoUtil: CryptoUtil = CryptoUtil(aapsLogger) private var cryptoUtil: CryptoUtil = CryptoUtil(aapsLogger)

View file

@ -6,13 +6,10 @@ import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
import java.util.* import java.util.*
@RunWith(PowerMockRunner::class)
class DateUtilTest : TestBase() { class DateUtilTest : TestBase() {
@Mock lateinit var context: Context @Mock lateinit var context: Context

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.utils
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class DecimalFormatterTest { class DecimalFormatterTest {
@Test fun to0DecimalTest() { @Test fun to0DecimalTest() {

View file

@ -3,11 +3,8 @@ package info.nightscout.androidaps.utils
import org.json.JSONObject import org.json.JSONObject
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@RunWith(PowerMockRunner::class)
class JsonHelperTest { class JsonHelperTest {
private val jsonString = "{\"d\":\"3.0\",\"i\":\"4\",\"s\":\"5\",\"b\":\"true\",\"j\":{\"a\": \"1\"}}" private val jsonString = "{\"d\":\"3.0\",\"i\":\"4\",\"s\":\"5\",\"b\":\"true\",\"j\":{\"a\": \"1\"}}"

View file

@ -4,7 +4,11 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.extensions.pureProfileFromJson 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.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.DefaultValueHelper
@ -13,10 +17,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject import org.json.JSONObject
import org.junit.Before import org.junit.Before
import org.mockito.Mock import org.mockito.Mock
import org.powermock.core.classloader.annotations.PrepareForTest
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@PrepareForTest(FabricPrivacy::class)
open class TestBaseWithProfile : TestBase() { open class TestBaseWithProfile : TestBase() {
@Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var activePluginProvider: ActivePlugin

View file

@ -5,11 +5,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class DanaPumpTest : TestBaseWithProfile() { class DanaPumpTest : TestBaseWithProfile() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP

View file

@ -4,7 +4,11 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.extensions.pureProfileFromJson 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.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.DefaultValueHelper
@ -13,10 +17,8 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject import org.json.JSONObject
import org.junit.Before import org.junit.Before
import org.mockito.Mock import org.mockito.Mock
import org.powermock.core.classloader.annotations.PrepareForTest
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
@PrepareForTest(FabricPrivacy::class)
open class TestBaseWithProfile : TestBase() { open class TestBaseWithProfile : TestBase() {
@Mock lateinit var activePluginProvider: ActivePlugin @Mock lateinit var activePluginProvider: ActivePlugin

View file

@ -17,14 +17,9 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when` 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() { class DanaRPluginTest : TestBaseWithProfile() {
@Mock lateinit var context: Context @Mock lateinit var context: Context

View file

@ -27,9 +27,7 @@ import org.mockito.Mock
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.mockito.Mockito.anyBoolean import org.mockito.Mockito.anyBoolean
import org.mockito.Mockito.doNothing 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() { open class DanaRTestBase : TestBase() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP

View file

@ -4,11 +4,8 @@ import info.nightscout.androidaps.danar.comm.MessageHashTableR
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito import org.mockito.Mockito
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MessageHashTableRTest : DanaRTestBase() { class MessageHashTableRTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -5,12 +5,9 @@ import info.nightscout.androidaps.danar.comm.MsgBolusProgress
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgBolusProgressTest : DanaRTestBase() { class MsgBolusProgressTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,16 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgBolusStart import info.nightscout.androidaps.danar.comm.MsgBolusStart
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` 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() { class MsgBolusStartTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,16 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito 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() { class MsgBolusStartWithSpeedTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -5,11 +5,8 @@ import info.nightscout.androidaps.danar.comm.MsgBolusStop
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgBolusStopTest : DanaRTestBase() { class MsgBolusStopTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -4,10 +4,7 @@ import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.danar.comm.MsgCheckValue import info.nightscout.androidaps.danar.comm.MsgCheckValue
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgCheckValueTest : DanaRTestBase() { class MsgCheckValueTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgError import info.nightscout.androidaps.danar.comm.MsgError
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgErrorTest : DanaRTestBase() { class MsgErrorTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryAlarmTest : DanaRTestBase() { class MsgHistoryAlarmTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryAllDone import info.nightscout.androidaps.danar.comm.MsgHistoryAllDone
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryAllDoneTest : DanaRTestBase() { class MsgHistoryAllDoneTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryAll import info.nightscout.androidaps.danar.comm.MsgHistoryAll
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryAllTest : DanaRTestBase() { class MsgHistoryAllTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryBasalHourTest : DanaRTestBase() { class MsgHistoryBasalHourTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryBolus import info.nightscout.androidaps.danar.comm.MsgHistoryBolus
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryBolusTest : DanaRTestBase() { class MsgHistoryBolusTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryCarboTest : DanaRTestBase() { class MsgHistoryCarboTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryDailyInsulinTest : DanaRTestBase() { class MsgHistoryDailyInsulinTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryDone import info.nightscout.androidaps.danar.comm.MsgHistoryDone
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryDoneTest : DanaRTestBase() { class MsgHistoryDoneTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryError import info.nightscout.androidaps.danar.comm.MsgHistoryError
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryErrorTest : DanaRTestBase() { class MsgHistoryErrorTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryGlucoseTest : DanaRTestBase() { class MsgHistoryGlucoseTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryNewDone import info.nightscout.androidaps.danar.comm.MsgHistoryNewDone
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryNewDoneTest : DanaRTestBase() { class MsgHistoryNewDoneTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryNew import info.nightscout.androidaps.danar.comm.MsgHistoryNew
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryNewTest : DanaRTestBase() { class MsgHistoryNewTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryRefill import info.nightscout.androidaps.danar.comm.MsgHistoryRefill
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistoryRefillTest : DanaRTestBase() { class MsgHistoryRefillTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistorySuspend import info.nightscout.androidaps.danar.comm.MsgHistorySuspend
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgHistorySuspendTest : DanaRTestBase() { class MsgHistorySuspendTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBasic import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBasic
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgInitConnStatusBasicTest : DanaRTestBase() { class MsgInitConnStatusBasicTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBolus import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBolus
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgInitConnStatusBolusTest : DanaRTestBase() { class MsgInitConnStatusBolusTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusOption import info.nightscout.androidaps.danar.comm.MsgInitConnStatusOption
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgInitConnStatusOptionTest : DanaRTestBase() { class MsgInitConnStatusOptionTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusTime import info.nightscout.androidaps.danar.comm.MsgInitConnStatusTime
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgInitConnStatusTimeTest : DanaRTestBase() { class MsgInitConnStatusTimeTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgPCCommStart import info.nightscout.androidaps.danar.comm.MsgPCCommStart
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgPCCommStartTest : DanaRTestBase() { class MsgPCCommStartTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgPCCommStop import info.nightscout.androidaps.danar.comm.MsgPCCommStop
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgPCCommStopTest : DanaRTestBase() { class MsgPCCommStopTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetActivateBasalProfile import info.nightscout.androidaps.danar.comm.MsgSetActivateBasalProfile
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetActivateBasalProfileTest : DanaRTestBase() { class MsgSetActivateBasalProfileTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetBasalProfileTest : DanaRTestBase() { class MsgSetBasalProfileTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetCarbsEntryTest : DanaRTestBase() { class MsgSetCarbsEntryTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,16 +2,10 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` 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() { class MsgSetExtendedBolusStartTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetExtendedBolusStopTest : DanaRTestBase() { class MsgSetExtendedBolusStopTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetSingleBasalProfile import info.nightscout.androidaps.danar.comm.MsgSetSingleBasalProfile
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetSingleBasalProfileTest : DanaRTestBase() { class MsgSetSingleBasalProfileTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetTempBasalStartTest : DanaRTestBase() { class MsgSetTempBasalStartTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetTime import info.nightscout.androidaps.danar.comm.MsgSetTime
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetTimeTest : DanaRTestBase() { class MsgSetTimeTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetUserOptions import info.nightscout.androidaps.danar.comm.MsgSetUserOptions
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSetUserOptionsTest : DanaRTestBase() { class MsgSetUserOptionsTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -3,10 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSettingActiveProfileTest : DanaRTestBase() { class MsgSettingActiveProfileTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -2,10 +2,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSettingBasalProfileAll import info.nightscout.androidaps.danar.comm.MsgSettingBasalProfileAll
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class)
class MsgSettingBasalProfileAllTest : DanaRTestBase() { class MsgSettingBasalProfileAllTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

View file

@ -4,13 +4,8 @@ import info.nightscout.androidaps.danar.comm.MsgSettingBasal
import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpDescription
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when` 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() { class MsgSettingBasalTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {

Some files were not shown because too many files have changed in this diff Show more