parent
fdc9ac1bf6
commit
584c014263
1 changed files with 8 additions and 11 deletions
|
@ -16,9 +16,9 @@ import app.aaps.plugins.automation.triggers.Trigger
|
||||||
import app.aaps.plugins.automation.ui.TimerUtil
|
import app.aaps.plugins.automation.ui.TimerUtil
|
||||||
import app.aaps.shared.impl.utils.DateUtilImpl
|
import app.aaps.shared.impl.utils.DateUtilImpl
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers.any
|
import org.mockito.ArgumentMatchers.any
|
||||||
|
@ -52,27 +52,24 @@ class CarbTimerImplTest : TestBase() {
|
||||||
|
|
||||||
private lateinit var automationPlugin: AutomationPlugin
|
private lateinit var automationPlugin: AutomationPlugin
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach fun init() {
|
||||||
fun init() {
|
|
||||||
Mockito.`when`(rh.gs(anyInt())).thenReturn("")
|
Mockito.`when`(rh.gs(anyInt())).thenReturn("")
|
||||||
Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
|
Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
|
||||||
dateUtil = DateUtilImpl(context)
|
dateUtil = DateUtilImpl(context)
|
||||||
timerUtil = TimerUtil(context)
|
timerUtil = TimerUtil(context)
|
||||||
automationPlugin = AutomationPlugin(
|
automationPlugin = AutomationPlugin(
|
||||||
injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil,
|
injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil, activePlugin, timerUtil
|
||||||
activePlugin, timerUtil
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test fun doTest() {
|
||||||
fun doTest() {
|
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||||
Assertions.assertEquals(0, automationPlugin.size())
|
|
||||||
automationPlugin.scheduleAutomationEventEatReminder()
|
automationPlugin.scheduleAutomationEventEatReminder()
|
||||||
Assertions.assertEquals(1, automationPlugin.size())
|
assertThat(automationPlugin.size()).isEqualTo(1)
|
||||||
automationPlugin.removeAutomationEventEatReminder()
|
automationPlugin.removeAutomationEventEatReminder()
|
||||||
Assertions.assertEquals(0, automationPlugin.size())
|
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||||
|
|
||||||
automationPlugin.scheduleTimeToEatReminder(1)
|
automationPlugin.scheduleTimeToEatReminder(1)
|
||||||
Mockito.verify(context, Mockito.times(1)).startActivity(any())
|
Mockito.verify(context, Mockito.times(1)).startActivity(any())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue