fix tests

This commit is contained in:
Milos Kozak 2021-11-01 08:03:48 +01:00
parent 543719b091
commit 085ff63d63
3 changed files with 4 additions and 1 deletions

View file

@ -34,7 +34,7 @@ open class TestBaseWithProfile : TestBase() {
val rxBus = RxBus(aapsSchedulers, aapsLogger) val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector { private val profileInjector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
} }
} }

View file

@ -7,6 +7,7 @@ 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.mockito.ArgumentMatchers
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when` import org.mockito.Mockito.`when`
@ -38,6 +39,7 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
} }
@Test fun doActionTest() { @Test fun doActionTest() {
`when`(profileFunction.createProfileSwitch(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt())).thenReturn(true)
sut.pct = InputPercent(110.0) sut.pct = InputPercent(110.0)
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES) sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
sut.doAction(object : Callback() { sut.doAction(object : Callback() {

View file

@ -80,6 +80,7 @@ class ActionProfileSwitchTest : ActionsTestBase() {
// do profile switch // do profile switch
`when`(profileFunction.getProfileName()).thenReturn("Test") `when`(profileFunction.getProfileName()).thenReturn("Test")
`when`(profileFunction.createProfileSwitch(anyObject(), anyString(), anyInt(), anyInt(), anyInt(), anyLong())).thenReturn(true)
sut.inputProfileName = InputProfileName(resourceHelper, activePlugin, TESTPROFILENAME) sut.inputProfileName = InputProfileName(resourceHelper, activePlugin, TESTPROFILENAME)
sut.doAction(object : Callback() { sut.doAction(object : Callback() {
override fun run() { override fun run() {