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 0aa864c7cf..6dc184e56b 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 @@ -227,6 +227,8 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() { `when`(rh.gs(R.string.smscommunicator_code_from_authenticator_for)).thenReturn("from Authenticator app for: %1\$s followed by PIN") `when`(rh.gs(R.string.patient_name_default)).thenReturn("User") `when`(rh.gs(R.string.invalidprofile)).thenReturn("Invalid profile !!!") + `when`(rh.gs(R.string.sms)).thenReturn("SMS") + `when`(rh.gs(ArgumentMatchers.eq(R.string.bolus_u_min), ArgumentMatchers.any())).thenAnswer { i: InvocationOnMock -> "BOLUS " + i.arguments[1] + " U" } `when`(rh.gsNotLocalised(R.string.loopsuspended)).thenReturn("Loop suspended") `when`(rh.gsNotLocalised(R.string.smscommunicator_stoppedsms)).thenReturn("SMS Remote Service stopped. To reactivate it, use AAPS on master smartphone.") `when`(rh.gsNotLocalised(R.string.profileswitchcreated)).thenReturn("Profile switch created") diff --git a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt index 9c6688791d..d2a2d3fac5 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/QueueThreadTest.kt @@ -4,6 +4,7 @@ import android.content.Context import android.os.PowerManager import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestPumpPlugin import info.nightscout.androidaps.database.AppRepository @@ -21,8 +22,10 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before import org.junit.Test +import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito +import org.mockito.invocation.InvocationOnMock class QueueThreadTest : TestBaseWithProfile() { @@ -41,6 +44,7 @@ class QueueThreadTest : TestBaseWithProfile() { } if (it is CommandTempBasalAbsolute) { it.activePlugin = activePlugin + it.rh = rh } } } @@ -75,6 +79,8 @@ class QueueThreadTest : TestBaseWithProfile() { val percentageConstraint = Constraint(0) Mockito.`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())) .thenReturn(percentageConstraint) + Mockito.`when`(rh.gs(ArgumentMatchers.eq(R.string.temp_basal_absolute), ArgumentMatchers.anyDouble(), ArgumentMatchers.anyInt())).thenReturn("TEMP BASAL %1\$.2f U/h %2\$d min").thenAnswer { + i: InvocationOnMock -> "TEMP BASAL " + i.arguments[1] + " U/h " + i.arguments[2] + "min" } sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp) }