fix tests

This commit is contained in:
Milos Kozak 2023-09-26 13:33:11 +02:00
parent 905916e1eb
commit 7a53601556
15 changed files with 29 additions and 29 deletions

View file

@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import info.nightscout.plugins.iob.iobCobCalculator.data.AutosensDataObject import info.nightscout.plugins.iob.iobCobCalculator.data.AutosensDataObject
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
@ -100,7 +100,7 @@ class TriggerAutosensValueTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(R.drawable.ic_as), TriggerAutosensValue(injector).icon()) assertThat(TriggerAutosensValue(injector).icon().get()).isEqualTo(R.drawable.ic_as)
} }
private fun generateAutosensData(): AutosensDataObject { private fun generateAutosensData(): AutosensDataObject {

View file

@ -1,7 +1,7 @@
package app.aaps.plugins.automation.triggers package app.aaps.plugins.automation.triggers
import app.aaps.plugins.automation.elements.ComparatorConnect import app.aaps.plugins.automation.elements.ComparatorConnect
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -31,7 +31,7 @@ class TriggerBTDeviceTest : TriggerTestBase() {
@Test @Test
fun icon() { fun icon() {
Assertions.assertEquals(Optional.of(app.aaps.core.ui.R.drawable.ic_bluetooth_white_48dp), TriggerBTDevice(injector).icon()) assertThat(TriggerBTDevice(injector).icon().get()).isEqualTo(app.aaps.core.ui.R.drawable.ic_bluetooth_white_48dp)
} }
@Test fun duplicate() { @Test fun duplicate() {

View file

@ -4,7 +4,7 @@ import app.aaps.core.interfaces.db.GlucoseUnit
import app.aaps.core.interfaces.iob.InMemoryGlucoseValue import app.aaps.core.interfaces.iob.InMemoryGlucoseValue
import app.aaps.database.entities.GlucoseValue import app.aaps.database.entities.GlucoseValue
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -74,7 +74,7 @@ class TriggerBgTest : TriggerTestBase() {
@Test @Test
fun iconTest() { fun iconTest() {
Assertions.assertEquals(Optional.of(app.aaps.core.main.R.drawable.ic_cp_bgcheck), TriggerBg(injector).icon()) assertThat(TriggerBg(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_cp_bgcheck)
} }
private fun generateOneCurrentRecordBgData(): MutableList<InMemoryGlucoseValue> { private fun generateOneCurrentRecordBgData(): MutableList<InMemoryGlucoseValue> {

View file

@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.database.ValueWrapper import app.aaps.database.ValueWrapper
import app.aaps.database.entities.Bolus import app.aaps.database.entities.Bolus
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.core.Single
import org.json.JSONException import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
@ -86,6 +86,6 @@ class TriggerBolusAgoTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(app.aaps.core.main.R.drawable.ic_bolus), TriggerBolusAgo(injector).icon()) assertThat(TriggerBolusAgo(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_bolus)
} }
} }

View file

@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.core.interfaces.iob.CobInfo import app.aaps.core.interfaces.iob.CobInfo
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -58,6 +58,6 @@ class TriggerCOBTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(app.aaps.core.main.R.drawable.ic_cp_bolus_carbs), TriggerCOB(injector).icon()) assertThat(TriggerCOB(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_cp_bolus_carbs)
} }
} }

View file

@ -79,7 +79,7 @@ class TriggerDeltaTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
assertThat(TriggerDelta(injector).icon()).hasValue(R.drawable.ic_auto_delta) assertThat(TriggerDelta(injector).icon().get()).isEqualTo(R.drawable.ic_auto_delta)
} }
@Test fun initializerTest() { @Test fun initializerTest() {

View file

@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.core.interfaces.iob.IobTotal import app.aaps.core.interfaces.iob.IobTotal
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -60,7 +60,7 @@ class TriggerIobTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(R.drawable.ic_keyboard_capslock), TriggerIob(injector).icon()) assertThat(TriggerIob(injector).icon().get()).isEqualTo(R.drawable.ic_keyboard_capslock)
} }
private fun generateIobRecordData(): IobTotal { private fun generateIobRecordData(): IobTotal {

View file

@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers
import android.location.Location import android.location.Location
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.InputLocationMode import app.aaps.plugins.automation.elements.InputLocationMode
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONException import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
@ -92,7 +92,7 @@ class TriggerLocationTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(R.drawable.ic_location_on), TriggerLocation(injector).icon()) assertThat(TriggerLocation(injector).icon().get()).isEqualTo(R.drawable.ic_location_on)
} }
private fun mockedLocation(): Location { private fun mockedLocation(): Location {

View file

@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -57,7 +57,7 @@ class TriggerProfilePercentTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(app.aaps.core.ui.R.drawable.ic_actions_profileswitch), TriggerProfilePercent(injector).icon()) assertThat(TriggerProfilePercent(injector).icon().get()).isEqualTo(app.aaps.core.ui.R.drawable.ic_actions_profileswitch)
} }
@Test fun friendlyNameTest() { @Test fun friendlyNameTest() {

View file

@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -53,7 +53,7 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(app.aaps.core.main.R.drawable.ic_remove), TriggerPumpLastConnection(injector).icon()) assertThat(TriggerPumpLastConnection(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_remove)
} }
@Test fun friendlyNameTest() { @Test fun friendlyNameTest() {

View file

@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.ComparatorExists import app.aaps.plugins.automation.elements.ComparatorExists
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -43,6 +43,6 @@ class TriggerTempTargetTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(R.drawable.ic_keyboard_tab), TriggerTempTarget(injector).icon()) assertThat(TriggerTempTarget(injector).icon().get()).isEqualTo(R.drawable.ic_keyboard_tab)
} }
} }

View file

@ -5,7 +5,7 @@ import app.aaps.database.ValueWrapper
import app.aaps.database.entities.TemporaryTarget import app.aaps.database.entities.TemporaryTarget
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.core.Single
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
@ -88,7 +88,7 @@ class TriggerTempTargetValueTest : TriggerTestBase() {
@Test @Test
fun iconTest() { fun iconTest() {
Assertions.assertEquals(Optional.of(R.drawable.ic_keyboard_tab), TriggerTempTargetValue(injector).icon()) assertThat(TriggerTempTargetValue(injector).icon().get()).isEqualTo(R.drawable.ic_keyboard_tab)
} }
} }

View file

@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.core.interfaces.utils.MidnightTime import app.aaps.core.interfaces.utils.MidnightTime
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -66,6 +66,6 @@ class TriggerTimeRangeTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(app.aaps.core.main.R.drawable.ic_access_alarm_24dp), TriggerTimeRange(injector).icon()) assertThat(TriggerTimeRange(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
} }
} }

View file

@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.core.interfaces.utils.T import app.aaps.core.interfaces.utils.T
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -62,6 +62,6 @@ class TriggerTimeTest : TriggerTestBase() {
@Test @Test
fun iconTest() { fun iconTest() {
Assertions.assertEquals(Optional.of(app.aaps.core.main.R.drawable.ic_access_alarm_24dp), TriggerTime(injector).icon()) assertThat(TriggerTime(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
} }
} }

View file

@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers
import app.aaps.core.interfaces.rx.events.EventNetworkChange import app.aaps.core.interfaces.rx.events.EventNetworkChange
import app.aaps.plugins.automation.R import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator import app.aaps.plugins.automation.elements.Comparator
import com.google.common.base.Optional import com.google.common.truth.Truth.assertThat
import org.json.JSONException import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions
@ -54,7 +54,7 @@ class TriggerWifiSsidTest : TriggerTestBase() {
} }
@Test fun iconTest() { @Test fun iconTest() {
Assertions.assertEquals(Optional.of(R.drawable.ic_network_wifi), TriggerWifiSsid(injector).icon()) assertThat(TriggerWifiSsid(injector).icon().get()).isEqualTo(R.drawable.ic_network_wifi)
} }
@Test fun friendlyNameTest() { @Test fun friendlyNameTest() {