Fix Tests
This commit is contained in:
parent
518f283650
commit
bbab3b0c9d
2 changed files with 8 additions and 0 deletions
|
@ -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.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.patient_name_default)).thenReturn("User")
|
||||||
`when`(rh.gs(R.string.invalidprofile)).thenReturn("Invalid profile !!!")
|
`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.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.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")
|
`when`(rh.gsNotLocalised(R.string.profileswitchcreated)).thenReturn("Profile switch created")
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.TestBaseWithProfile
|
import info.nightscout.androidaps.TestBaseWithProfile
|
||||||
import info.nightscout.androidaps.TestPumpPlugin
|
import info.nightscout.androidaps.TestPumpPlugin
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
|
@ -21,8 +22,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.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
import org.mockito.invocation.InvocationOnMock
|
||||||
|
|
||||||
class QueueThreadTest : TestBaseWithProfile() {
|
class QueueThreadTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
|
@ -41,6 +44,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
}
|
}
|
||||||
if (it is CommandTempBasalAbsolute) {
|
if (it is CommandTempBasalAbsolute) {
|
||||||
it.activePlugin = activePlugin
|
it.activePlugin = activePlugin
|
||||||
|
it.rh = rh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,6 +79,8 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
val percentageConstraint = Constraint(0)
|
val percentageConstraint = Constraint(0)
|
||||||
Mockito.`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject()))
|
Mockito.`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject()))
|
||||||
.thenReturn(percentageConstraint)
|
.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)
|
sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue