From 394ba420aa06b7ff8f315298360ce9c8304f731e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 1 Mar 2020 16:39:23 +0100 Subject: [PATCH] DanaRS tests --- ...S_Packet_Bolus_Get_Extended_BolusTest.java | 65 ------------------ ...aRS_Packet_Bolus_Get_Extended_BolusTest.kt | 28 ++++++++ ...et_Bolus_Get_Extended_Bolus_StateTest.java | 65 ------------------ ...cket_Bolus_Get_Extended_Bolus_StateTest.kt | 31 +++++++++ ...us_Get_Extended_Menu_Option_StateTest.java | 66 ------------------- ...olus_Get_Extended_Menu_Option_StateTest.kt | 27 ++++++++ ...RS_Packet_Bolus_Get_Initial_BolusTest.java | 65 ------------------ ...naRS_Packet_Bolus_Get_Initial_BolusTest.kt | 28 ++++++++ ..._Bolus_Get_Step_Bolus_InformationTest.java | 65 ------------------ ...et_Bolus_Get_Step_Bolus_InformationTest.kt | 27 ++++++++ ...aRS_Packet_Bolus_Set_Bolus_OptionTest.java | 65 ------------------ ...anaRS_Packet_Bolus_Set_Bolus_OptionTest.kt | 29 ++++++++ ...aRS_Packet_Bolus_Set_CIR_CF_ArrayTest.java | 65 ------------------ ...anaRS_Packet_Bolus_Set_CIR_CF_ArrayTest.kt | 29 ++++++++ 14 files changed, 199 insertions(+), 456 deletions(-) delete mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.java create mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.kt delete mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest.java create mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest.kt delete mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.java create mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt delete mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.java create mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt delete mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.java create mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt delete mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Bolus_OptionTest.java create mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Bolus_OptionTest.kt delete mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest.java create mode 100644 app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest.kt diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.java deleted file mode 100644 index 920ba7cc86..0000000000 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_BolusTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.danaRS.comm; - - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import info.AAPSMocker; -import info.nightscout.androidaps.MainApp; -import info.nightscout.androidaps.logging.L; -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump; -import info.nightscout.androidaps.utils.SP; - -import static org.junit.Assert.assertEquals; - -/** - * Created by Rumen on 06.08.2018. - */ - -@RunWith(PowerMockRunner.class) -@PrepareForTest({MainApp.class, SP.class, L.class}) -public class DanaRS_Packet_Bolus_Get_Extended_BolusTest { - - @Test - public void runTest() { - AAPSMocker.mockMainApp(); - AAPSMocker.mockApplicationContext(); - AAPSMocker.mockSP(); - AAPSMocker.mockL(); - DanaRS_Packet_Bolus_Get_Extended_Bolus packet = new DanaRS_Packet_Bolus_Get_Extended_Bolus(); - - // test params - assertEquals(null, packet.getRequestParams()); - - // test message decoding - double testValue = 0d; - packet.handleMessage(createArray(10, (byte) testValue)); - assertEquals(testValue != 0d, packet.failed); - testValue = 1d; - packet.handleMessage(createArray(10, (byte) testValue)); - // is pump.bolustep set to 1 - DanaRPump pump = DanaRPump.getInstance(); - assertEquals(testValue / 100d, pump.bolusStep, 0); - assertEquals(testValue != 0d, packet.failed); - - assertEquals("BOLUS__GET_EXTENDED_BOLUS", packet.getFriendlyName()); - } - - byte[] createArray(int length, byte fillWith){ - byte[] ret = new byte[length]; - for(int i = 0; i