From 110c418d0178a4b5fefadb98ed5441bf808c9727 Mon Sep 17 00:00:00 2001 From: johan12345 Date: Fri, 9 Jul 2021 16:14:09 +0200 Subject: [PATCH] update unit tests after API module restructuring --- .../{viewmodel/FilterViewModelTest.kt => api/UtilsTest.kt} | 4 ++-- .../evmap/api/availability/AvailabilityDetectorTest.kt | 2 +- .../api/availability/NewMotionAvailabilityDetectorTest.kt | 4 ++-- .../vonforst/evmap/api/chargeprice/ChargepriceApiTest.kt | 4 ++-- .../evmap/api/goingelectric/GoingElectricApiTest.kt | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) rename app/src/test/java/net/vonforst/evmap/{viewmodel/FilterViewModelTest.kt => api/UtilsTest.kt} (91%) diff --git a/app/src/test/java/net/vonforst/evmap/viewmodel/FilterViewModelTest.kt b/app/src/test/java/net/vonforst/evmap/api/UtilsTest.kt similarity index 91% rename from app/src/test/java/net/vonforst/evmap/viewmodel/FilterViewModelTest.kt rename to app/src/test/java/net/vonforst/evmap/api/UtilsTest.kt index fde6e3b9..b58d7416 100644 --- a/app/src/test/java/net/vonforst/evmap/viewmodel/FilterViewModelTest.kt +++ b/app/src/test/java/net/vonforst/evmap/api/UtilsTest.kt @@ -1,10 +1,10 @@ -package net.vonforst.evmap.viewmodel +package net.vonforst.evmap.api import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test -class FilterViewModelTest { +class UtilsTest { @Test fun testPowerMapping() { val sliderValues = powerSteps.indices.toList() diff --git a/app/src/test/java/net/vonforst/evmap/api/availability/AvailabilityDetectorTest.kt b/app/src/test/java/net/vonforst/evmap/api/availability/AvailabilityDetectorTest.kt index 08389375..a4a1eeb8 100644 --- a/app/src/test/java/net/vonforst/evmap/api/availability/AvailabilityDetectorTest.kt +++ b/app/src/test/java/net/vonforst/evmap/api/availability/AvailabilityDetectorTest.kt @@ -1,6 +1,6 @@ package net.vonforst.evmap.api.availability -import net.vonforst.evmap.api.goingelectric.Chargepoint +import net.vonforst.evmap.model.Chargepoint import org.junit.Assert.assertEquals import org.junit.Test diff --git a/app/src/test/java/net/vonforst/evmap/api/availability/NewMotionAvailabilityDetectorTest.kt b/app/src/test/java/net/vonforst/evmap/api/availability/NewMotionAvailabilityDetectorTest.kt index df844c05..322bbee6 100644 --- a/app/src/test/java/net/vonforst/evmap/api/availability/NewMotionAvailabilityDetectorTest.kt +++ b/app/src/test/java/net/vonforst/evmap/api/availability/NewMotionAvailabilityDetectorTest.kt @@ -2,8 +2,8 @@ package net.vonforst.evmap.api.availability import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking -import net.vonforst.evmap.api.goingelectric.ChargeLocation import net.vonforst.evmap.api.goingelectric.GoingElectricApi +import net.vonforst.evmap.model.ChargeLocation import net.vonforst.evmap.okResponse import okhttp3.OkHttpClient import okhttp3.mockwebserver.Dispatcher @@ -67,7 +67,7 @@ class NewMotionAvailabilityDetectorTest { fun apiTest() { for (chargepoint in listOf(2105L, 18284L)) { val charger = runBlocking { api.getChargepointDetail(chargepoint).body()!! } - .chargelocations[0] as ChargeLocation + .chargelocations[0].convert("") as ChargeLocation println(charger) runBlocking { diff --git a/app/src/test/java/net/vonforst/evmap/api/chargeprice/ChargepriceApiTest.kt b/app/src/test/java/net/vonforst/evmap/api/chargeprice/ChargepriceApiTest.kt index 1fe06a77..f89f6683 100644 --- a/app/src/test/java/net/vonforst/evmap/api/chargeprice/ChargepriceApiTest.kt +++ b/app/src/test/java/net/vonforst/evmap/api/chargeprice/ChargepriceApiTest.kt @@ -2,8 +2,8 @@ package net.vonforst.evmap.api.chargeprice import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking -import net.vonforst.evmap.api.goingelectric.ChargeLocation import net.vonforst.evmap.api.goingelectric.GoingElectricApi +import net.vonforst.evmap.model.ChargeLocation import net.vonforst.evmap.okResponse import okhttp3.mockwebserver.Dispatcher import okhttp3.mockwebserver.MockResponse @@ -58,7 +58,7 @@ class ChargepriceApiTest { fun apiTest() { for (chargepoint in listOf(2105L, 18284L)) { val charger = runBlocking { ge.getChargepointDetail(chargepoint).body()!! } - .chargelocations[0] as ChargeLocation + .chargelocations[0].convert("") as ChargeLocation println(charger) runBlocking { diff --git a/app/src/test/java/net/vonforst/evmap/api/goingelectric/GoingElectricApiTest.kt b/app/src/test/java/net/vonforst/evmap/api/goingelectric/GoingElectricApiTest.kt index 173887b3..8cad12f1 100644 --- a/app/src/test/java/net/vonforst/evmap/api/goingelectric/GoingElectricApiTest.kt +++ b/app/src/test/java/net/vonforst/evmap/api/goingelectric/GoingElectricApiTest.kt @@ -59,7 +59,7 @@ class GoingElectricApiTest { assertEquals("ok", body.status) assertEquals(null, body.startkey) assertEquals(1, body.chargelocations.size) - val charger = body.chargelocations[0] as ChargeLocation + val charger = body.chargelocations[0] as GEChargeLocation assertEquals(2105, charger.id) } @@ -73,7 +73,7 @@ class GoingElectricApiTest { assertEquals("ok", body.status) assertEquals(null, body.startkey) assertEquals(2, body.chargelocations.size) - val charger = body.chargelocations[0] as ChargeLocation + val charger = body.chargelocations[0] as GEChargeLocation assertEquals(41161, charger.id) } @@ -99,7 +99,7 @@ class GoingElectricApiTest { assertEquals("ok", body.status) assertEquals(2, body.startkey) assertEquals(2, body.chargelocations.size) - val charger = body.chargelocations[0] as ChargeLocation + val charger = body.chargelocations[0] as GEChargeLocation assertEquals(41161, charger.id) } } \ No newline at end of file