From 4724cf60482cfc1ce1177a1909de5003d7eef2d1 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sun, 9 Aug 2020 20:27:21 +0200 Subject: [PATCH] Fix AapsPodStateManagerTest --- .../defs/state/AapsPodStateManagerTest.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java index 85d8dd897e..cd82ae9ea5 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/state/AapsPodStateManagerTest.java @@ -5,21 +5,30 @@ import org.joda.time.DateTimeUtils; import org.joda.time.DateTimeZone; import org.joda.time.Duration; import org.junit.After; -import org.junit.Ignore; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.Mock; +import org.powermock.modules.junit4.PowerMockRunner; -import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.logging.AAPSLogger; +import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion; +import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus; import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsPodStateManager; +import info.nightscout.androidaps.utils.resources.ResourceHelper; +import info.nightscout.androidaps.utils.sharedPreferences.SP; import static org.junit.Assert.assertEquals; +@RunWith(PowerMockRunner.class) public class AapsPodStateManagerTest { - @Mock HasAndroidInjector hasAndroidInjector; + @Mock AAPSLogger aapsLogger; + @Mock SP sp; + @Mock OmnipodPumpStatus omnipodPumpStatus; + RxBusWrapper rxBus = new RxBusWrapper(); + @Mock ResourceHelper resourceHelper; @Test - @Ignore("Not Dagger compliant") // FIXME public void times() { DateTimeZone timeZone = DateTimeZone.UTC; DateTimeZone.setDefault(timeZone); @@ -28,7 +37,7 @@ public class AapsPodStateManagerTest { DateTimeUtils.setCurrentMillisFixed(now.getMillis()); - AapsPodStateManager podStateManager = new AapsPodStateManager(hasAndroidInjector); + AapsPodStateManager podStateManager = new AapsPodStateManager(aapsLogger, sp, omnipodPumpStatus, rxBus, resourceHelper); podStateManager.initState(0x0); podStateManager.setPairingParameters(0, 0, new FirmwareVersion(1, 1, 1), new FirmwareVersion(2, 2, 2), timeZone); @@ -38,7 +47,6 @@ public class AapsPodStateManagerTest { } @Test - @Ignore("Not Dagger compliant") // FIXME public void changeSystemTimeZoneWithoutChangingPodTimeZone() { DateTimeZone timeZone = DateTimeZone.UTC; DateTimeZone.setDefault(timeZone); @@ -47,7 +55,7 @@ public class AapsPodStateManagerTest { DateTimeUtils.setCurrentMillisFixed(now.getMillis()); - AapsPodStateManager podStateManager = new AapsPodStateManager(hasAndroidInjector); + AapsPodStateManager podStateManager = new AapsPodStateManager(aapsLogger, sp, omnipodPumpStatus, rxBus, resourceHelper); podStateManager.initState(0x0); podStateManager.setPairingParameters(0, 0, new FirmwareVersion(1, 1, 1), new FirmwareVersion(2, 2, 2), timeZone); @@ -62,7 +70,6 @@ public class AapsPodStateManagerTest { } @Test - @Ignore("Not Dagger compliant") // FIXME public void changeSystemTimeZoneAndChangePodTimeZone() { DateTimeZone timeZone = DateTimeZone.UTC; DateTimeZone.setDefault(timeZone); @@ -71,7 +78,7 @@ public class AapsPodStateManagerTest { DateTimeUtils.setCurrentMillisFixed(now.getMillis()); - AapsPodStateManager podStateManager = new AapsPodStateManager(hasAndroidInjector); + AapsPodStateManager podStateManager = new AapsPodStateManager(aapsLogger, sp, omnipodPumpStatus, rxBus, resourceHelper); podStateManager.initState(0x0); podStateManager.setPairingParameters(0, 0, new FirmwareVersion(1, 1, 1), new FirmwareVersion(2, 2, 2), timeZone);