diff --git a/app/src/main/res/layout/careportal_stats_fragment_lowres.xml b/app/src/main/res/layout/careportal_stats_fragment_lowres.xml
new file mode 100644
index 0000000000..7cd144893c
--- /dev/null
+++ b/app/src/main/res/layout/careportal_stats_fragment_lowres.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index 358e9b1299..60788036e4 100644
--- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -18,7 +18,12 @@ import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject
import org.junit.Before
+import org.mockito.ArgumentMatchers.anyDouble
+import org.mockito.ArgumentMatchers.anyInt
+import org.mockito.ArgumentMatchers.anyString
import org.mockito.Mock
+import org.mockito.Mockito
+import org.mockito.invocation.InvocationOnMock
@Suppress("SpellCheckingInspection")
open class TestBaseWithProfile : TestBase() {
@@ -64,6 +69,99 @@ open class TestBaseWithProfile : TestBase() {
originalEnd = 0,
insulinConfiguration = InsulinConfiguration("", 0, 0)
)
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ String.format(rh.gs(string), arg1)
+ }.`when`(rh).gs(anyInt(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ String.format(rh.gs(string), arg1)
+ }.`when`(rh).gs(anyInt(), anyDouble())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ String.format(rh.gs(string), arg1)
+ }.`when`(rh).gs(anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyString(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyString(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyDouble(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyDouble(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyString(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyDouble(), anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyString(), anyInt(), anyString())
+
}
fun getValidProfileStore(): ProfileStore {
diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
index bf0959fdd5..cd46c1048d 100644
--- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
@@ -113,16 +113,11 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
`when`(rh.gs(R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode")
`when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit")
`when`(rh.gs(R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
- `when`(rh.gs(R.string.limitingpercentrate, 0, "it must be positive value")).thenReturn("")
- `when`(rh.gs(R.string.limitingbolus, 3.0, "pump limit")).thenReturn("")
- `when`(rh.gs(R.string.limitingbolus, 6.0, "pump limit")).thenReturn("")
- `when`(rh.gs(R.string.limitingbasalratio, 0.8, "pump limit")).thenReturn("")
- `when`(rh.gs(R.string.limitingpercentrate, 200, "pump limit")).thenReturn("")
+ `when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
+ `when`(rh.gs(R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s")
+ `when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump")
- `when`(rh.gs(R.string.objectivenotstarted, 9)).thenReturn("Objective 9 not started")
- `when`(rh.gs(R.string.objectivenotstarted, 8)).thenReturn("Objective 8 not started")
- `when`(rh.gs(R.string.objectivenotstarted, 6)).thenReturn("Objective 6 not started")
- `when`(rh.gs(R.string.objectivenotstarted, 1)).thenReturn("Objective 1 not started")
+ `when`(rh.gs(R.string.objectivenotstarted)).thenReturn("Objective %1\$d not started")
// RS constructor
`when`(sp.getString(R.string.key_danars_address, "")).thenReturn("")
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt
index 6d868075c4..5575c973f7 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt
@@ -47,6 +47,12 @@ class SafetyPluginTest : TestBaseWithProfile() {
@Before
fun prepare() {
+ `when`(rh.gs(R.string.hardlimit)).thenReturn("hard limit")
+ `when`(rh.gs(R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
+ `when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit")
+ `when`(rh.gs(R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
+ `when`(rh.gs(R.string.maxbasalmultiplier)).thenReturn("max basal multiplier")
+ `when`(rh.gs(R.string.maxdailybasalmultiplier)).thenReturn("max daily basal multiplier")
`when`(rh.gs(R.string.limitingbolus)).thenReturn("Limiting bolus to %1\$.1f U because of %2\$s")
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(R.string.limitingiob)).thenReturn("Limiting IOB to %1\$.1f U because of %2\$s")
@@ -57,14 +63,8 @@ class SafetyPluginTest : TestBaseWithProfile() {
`when`(rh.gs(R.string.smbdisabledinpreferences)).thenReturn("SMB disabled in preferences")
`when`(rh.gs(R.string.closedmodedisabledinpreferences)).thenReturn("Closed loop mode disabled in preferences")
`when`(rh.gs(R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
- `when`(rh.gs(R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
- `when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit")
`when`(rh.gs(R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
`when`(rh.gs(R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode")
- `when`(rh.gs(R.string.maxvalueinpreferences)).thenReturn("max value in preferences")
- `when`(rh.gs(R.string.maxbasalmultiplier)).thenReturn("max basal multiplier")
- `when`(rh.gs(R.string.maxdailybasalmultiplier)).thenReturn("max daily basal multiplier")
- `when`(rh.gs(R.string.hardlimit)).thenReturn("hard limit")
`when`(rh.gs(R.string.key_child)).thenReturn("child")
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt
index 3888078520..55df56b198 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt
@@ -36,12 +36,13 @@ import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.ArgumentMatchers
+import org.mockito.ArgumentMatchers.anyString
+import org.mockito.ArgumentMatchers.eq
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.Mockito.`when`
import org.mockito.Mockito.anyLong
import org.mockito.invocation.InvocationOnMock
-import java.util.*
@Suppress("SpellCheckingInspection")
class SmsCommunicatorPluginTest : TestBaseWithProfile() {
@@ -160,7 +161,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
`when`(otp.name()).thenReturn("User")
- `when`(otp.checkOTP(ArgumentMatchers.anyString())).thenReturn(OneTimePasswordValidationResult.OK)
+ `when`(otp.checkOTP(anyString())).thenReturn(OneTimePasswordValidationResult.OK)
`when`(rh.gs(R.string.smscommunicator_remotecommandnotallowed)).thenReturn("Remote command is not allowed")
`when`(rh.gs(R.string.sms_wrongcode)).thenReturn("Wrong code. Command cancelled.")
@@ -179,7 +180,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
`when`(rh.gs(R.string.loopisdisabled)).thenReturn("Loop is disabled")
`when`(rh.gs(R.string.smscommunicator_loopisenabled)).thenReturn("Loop is enabled")
`when`(rh.gs(R.string.wrongformat)).thenReturn("Wrong format")
- `when`(rh.gs(ArgumentMatchers.eq(R.string.wrongTbrDuration), ArgumentMatchers.any())).thenAnswer { i: InvocationOnMock -> "TBR duration must be a multiple of " + i.arguments[1] + " minutes and greater than 0." }
+ `when`(rh.gs(eq(R.string.wrongTbrDuration), ArgumentMatchers.any())).thenAnswer { i: InvocationOnMock -> "TBR duration must be a multiple of " + i.arguments[1] + " minutes and greater than 0." }
`when`(rh.gs(R.string.smscommunicator_loophasbeendisabled)).thenReturn("Loop has been disabled")
`when`(rh.gs(R.string.smscommunicator_loophasbeenenabled)).thenReturn("Loop has been enabled")
`when`(rh.gs(R.string.smscommunicator_tempbasalcanceled)).thenReturn("Temp basal canceled")
@@ -998,6 +999,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
@Test fun processCarbsTest() {
`when`(dateUtilMocked.now()).thenReturn(1000000L)
+ `when`(dateUtilMocked.timeString(anyLong())).thenReturn("03:01AM")
`when`(sp.getBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)).thenReturn(false)
//CAL
smsCommunicatorPlugin.messages = ArrayList()
diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt
index 8a29540957..1f49ca02a5 100644
--- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt
@@ -137,6 +137,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
val percentageConstraint = Constraint(0)
`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())).thenReturn(percentageConstraint)
`when`(rh.gs(R.string.connectiontimedout)).thenReturn("Connection timed out")
+ `when`(rh.gs(R.string.formatinsulinunits)).thenReturn("%1\$.2f U")
}
@Test
diff --git a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index edc280d55e..0f4afa0fe6 100644
--- a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -1,43 +1,47 @@
package info.nightscout.androidaps
+import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.extensions.pureProfileFromJson
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Config
-import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ProfileStore
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.DateUtil
-import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.json.JSONObject
import org.junit.Before
+import org.mockito.ArgumentMatchers.anyDouble
+import org.mockito.ArgumentMatchers.anyInt
+import org.mockito.ArgumentMatchers.anyString
import org.mockito.Mock
+import org.mockito.Mockito
+import org.mockito.invocation.InvocationOnMock
@Suppress("SpellCheckingInspection")
open class TestBaseWithProfile : TestBase() {
@Mock lateinit var activePluginProvider: ActivePlugin
@Mock lateinit var rh: ResourceHelper
+ @Mock lateinit var iobCobCalculator: IobCobCalculator
@Mock lateinit var fabricPrivacy: FabricPrivacy
@Mock lateinit var profileFunction: ProfileFunction
- @Mock lateinit var defaultValueHelper: DefaultValueHelper
- @Mock lateinit var dateUtil: DateUtil
@Mock lateinit var config: Config
+ @Mock lateinit var context: Context
+ lateinit var dateUtil: DateUtil
val rxBus = RxBus(aapsSchedulers, aapsLogger)
- val profileInjector = HasAndroidInjector {
- AndroidInjector {
- }
- }
+ val profileInjector = HasAndroidInjector { AndroidInjector { } }
private lateinit var validProfileJSON: String
- lateinit var validProfile: Profile
+ lateinit var validProfile: ProfileSealed.Pure
+
@Suppress("PropertyName") val TESTPROFILENAME = "someProfile"
@Before
@@ -45,7 +49,101 @@ open class TestBaseWithProfile : TestBase() {
validProfileJSON = "{\"dia\":\"5\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"3\"}," +
"{\"time\":\"2:00\",\"value\":\"3.4\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4.5\"}]," +
"\"target_high\":[{\"time\":\"00:00\",\"value\":\"7\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}"
+ dateUtil = DateUtil(context)
validProfile = ProfileSealed.Pure(pureProfileFromJson(JSONObject(validProfileJSON), dateUtil)!!)
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ String.format(rh.gs(string), arg1)
+ }.`when`(rh).gs(anyInt(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ String.format(rh.gs(string), arg1)
+ }.`when`(rh).gs(anyInt(), anyDouble())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ String.format(rh.gs(string), arg1)
+ }.`when`(rh).gs(anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyString(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyString(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyDouble(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyDouble(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyInt())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ String.format(rh.gs(string), arg1, arg2)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyInt(), anyString(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyDouble(), anyInt(), anyString())
+
+ Mockito.doAnswer { invocation: InvocationOnMock ->
+ val string = invocation.getArgument(0)
+ val arg1 = invocation.getArgument(1)
+ val arg2 = invocation.getArgument(2)
+ val arg3 = invocation.getArgument(3)
+ String.format(rh.gs(string), arg1, arg2, arg3)
+ }.`when`(rh).gs(anyInt(), anyString(), anyInt(), anyString())
+
}
fun getValidProfileStore(): ProfileStore {
diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt
index 1cc8942bff..16bbb9112c 100644
--- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt
+++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.danaR
-import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants
@@ -22,7 +21,6 @@ import org.mockito.Mockito.`when`
class DanaRPluginTest : TestBaseWithProfile() {
- @Mock lateinit var context: Context
@Mock lateinit var constraintChecker: ConstraintChecker
@Mock lateinit var sp: SP
@Mock lateinit var commandQueue: CommandQueue
@@ -40,6 +38,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
fun prepareMocks() {
`when`(sp.getString(R.string.key_danars_address, "")).thenReturn("")
`when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit")
+ `when`(rh.gs(R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaPump = DanaPump(aapsLogger, sp, dateUtil, injector)
diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt
index ca9aa69fdc..6db1382b3a 100644
--- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt
+++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean
-import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants
@@ -22,7 +21,6 @@ import org.mockito.Mockito.`when`
class DanaRKoreanPluginTest : TestBaseWithProfile() {
- @Mock lateinit var context: Context
@Mock lateinit var constraintChecker: ConstraintChecker
@Mock lateinit var sp: SP
@Mock lateinit var commandQueue: CommandQueue
@@ -40,6 +38,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
fun prepareMocks() {
`when`(sp.getString(R.string.key_danars_address, "")).thenReturn("")
`when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit")
+ `when`(rh.gs(R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaPump = DanaPump(aapsLogger, sp, dateUtil, injector)
diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt
index b3eb9d0c4d..c0fc30ac73 100644
--- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt
+++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.danaRv2
-import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants
@@ -23,7 +22,6 @@ import org.mockito.Mockito.`when`
class DanaRv2PluginTest : TestBaseWithProfile() {
- @Mock lateinit var context: Context
@Mock lateinit var constraintChecker: ConstraintChecker
@Mock lateinit var sp: SP
@Mock lateinit var commandQueue: CommandQueue
@@ -43,6 +41,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
fun prepareMocks() {
`when`(sp.getString(R.string.key_danars_address, "")).thenReturn("")
`when`(rh.gs(R.string.pumplimit)).thenReturn("pump limit")
+ `when`(rh.gs(R.string.itmustbepositivevalue)).thenReturn("it must be positive value")
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaPump = DanaPump(aapsLogger, sp, dateUtil, injector)