From 7a536015564512886be9f6fd4f66395182b9a602 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 26 Sep 2023 13:33:11 +0200 Subject: [PATCH] fix tests --- .../plugins/automation/triggers/TriggerAutosensValueTest.kt | 4 ++-- .../aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt | 4 ++-- .../app/aaps/plugins/automation/triggers/TriggerBgTest.kt | 4 ++-- .../aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt | 4 ++-- .../app/aaps/plugins/automation/triggers/TriggerCOBTest.kt | 4 ++-- .../app/aaps/plugins/automation/triggers/TriggerDeltaTest.kt | 2 +- .../app/aaps/plugins/automation/triggers/TriggerIobTest.kt | 4 ++-- .../aaps/plugins/automation/triggers/TriggerLocationTest.kt | 4 ++-- .../plugins/automation/triggers/TriggerProfilePercentTest.kt | 4 ++-- .../automation/triggers/TriggerPumpLastConnectionTest.kt | 4 ++-- .../aaps/plugins/automation/triggers/TriggerTempTargetTest.kt | 4 ++-- .../plugins/automation/triggers/TriggerTempTargetValueTest.kt | 4 ++-- .../aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt | 4 ++-- .../app/aaps/plugins/automation/triggers/TriggerTimeTest.kt | 4 ++-- .../aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt index 6e7703d30d..765e255d2d 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.plugins.automation.R 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 org.json.JSONObject import org.junit.jupiter.api.Assertions @@ -100,7 +100,7 @@ class TriggerAutosensValueTest : TriggerTestBase() { } @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 { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt index 5904130b52..91b912d9ef 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt @@ -1,7 +1,7 @@ package app.aaps.plugins.automation.triggers 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -31,7 +31,7 @@ class TriggerBTDeviceTest : TriggerTestBase() { @Test 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() { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt index d953fe38d0..47bcb54ad3 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt @@ -4,7 +4,7 @@ import app.aaps.core.interfaces.db.GlucoseUnit import app.aaps.core.interfaces.iob.InMemoryGlucoseValue import app.aaps.database.entities.GlucoseValue 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach @@ -74,7 +74,7 @@ class TriggerBgTest : TriggerTestBase() { @Test 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 { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt index 7fdcfdb22e..8f53218183 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt @@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.database.ValueWrapper import app.aaps.database.entities.Bolus 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 org.json.JSONException import org.json.JSONObject @@ -86,6 +86,6 @@ class TriggerBolusAgoTest : TriggerTestBase() { } @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) } } \ No newline at end of file diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt index 83af189bdb..83e0930252 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.core.interfaces.iob.CobInfo 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach @@ -58,6 +58,6 @@ class TriggerCOBTest : TriggerTestBase() { } @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) } } \ No newline at end of file diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDeltaTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDeltaTest.kt index c28b196e2b..89eb07bd83 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDeltaTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDeltaTest.kt @@ -79,7 +79,7 @@ class TriggerDeltaTest : TriggerTestBase() { } @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() { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt index 9554e92409..e90b719e62 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt @@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.core.interfaces.iob.IobTotal import app.aaps.plugins.automation.R 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach @@ -60,7 +60,7 @@ class TriggerIobTest : TriggerTestBase() { } @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 { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt index 5d4586b8ec..c6a7ab9dff 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt @@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers import android.location.Location import app.aaps.plugins.automation.R 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.JSONObject import org.junit.jupiter.api.Assertions @@ -92,7 +92,7 @@ class TriggerLocationTest : TriggerTestBase() { } @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 { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt index e0acb777ae..fdaba24f13 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.plugins.automation.R 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach @@ -57,7 +57,7 @@ class TriggerProfilePercentTest : TriggerTestBase() { } @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() { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt index 53ef8d2752..3189efd24c 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.plugins.automation.R 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -53,7 +53,7 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() { } @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() { diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt index b5048045db..180f6fafbe 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.plugins.automation.R 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -43,6 +43,6 @@ class TriggerTempTargetTest : TriggerTestBase() { } @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) } } \ No newline at end of file diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt index a217f91419..ad599d9f32 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt @@ -5,7 +5,7 @@ import app.aaps.database.ValueWrapper import app.aaps.database.entities.TemporaryTarget import app.aaps.plugins.automation.R 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 org.json.JSONObject import org.junit.jupiter.api.Assertions @@ -88,7 +88,7 @@ class TriggerTempTargetValueTest : TriggerTestBase() { @Test 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) } } diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt index ac8ee9efce..a828c2035f 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.core.interfaces.utils.MidnightTime 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach @@ -66,6 +66,6 @@ class TriggerTimeRangeTest : TriggerTestBase() { } @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) } } \ No newline at end of file diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt index 71b49d9039..75736e9784 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt @@ -2,7 +2,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.core.interfaces.utils.T 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.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -62,6 +62,6 @@ class TriggerTimeTest : TriggerTestBase() { @Test 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) } } \ No newline at end of file diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt index 5001061c51..cd62a20eac 100644 --- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt +++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt @@ -3,7 +3,7 @@ package app.aaps.plugins.automation.triggers import app.aaps.core.interfaces.rx.events.EventNetworkChange import app.aaps.plugins.automation.R 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.JSONObject import org.junit.jupiter.api.Assertions @@ -54,7 +54,7 @@ class TriggerWifiSsidTest : TriggerTestBase() { } @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() {