DanaRS tests
This commit is contained in:
parent
a694edd170
commit
7be6a7b7a6
16 changed files with 144 additions and 263 deletions
|
@ -1,10 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import com.cozmo.danar.util.BleCommandUtil
|
||||
import info.TestBase
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
|
@ -12,7 +10,6 @@ import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
|
|||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
|
@ -22,16 +19,13 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(ConstraintChecker::class)
|
||||
class DanaRSMessageHashTableTest : TestBase() {
|
||||
class DanaRSMessageHashTableTest : DanaRSTestBase() {
|
||||
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var danaRSPlugin: DanaRSPlugin
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@Mock lateinit var sp: SP
|
||||
lateinit var danaRPump: DanaRPump
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
|
@ -42,9 +36,4 @@ class DanaRSMessageHashTableTest : TestBase() {
|
|||
val testPacket: DanaRS_Packet = danaRSMessageHashTable.findMessage(forTesting.command)
|
||||
Assert.assertEquals(BleCommandUtil.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.getOpCode().toLong())
|
||||
}
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
danaRPump = DanaRPump(aapsLogger, sp)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import org.junit.Before
|
||||
import org.mockito.Mock
|
||||
|
||||
open class DanaRSTestBase : TestBase() {
|
||||
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var sp: SP
|
||||
|
||||
lateinit var danaRPump: DanaRPump
|
||||
|
||||
fun createArray(length: Int, fillWith: Byte): ByteArray {
|
||||
val ret = ByteArray(length)
|
||||
for (i in 0 until length) {
|
||||
ret[i] = fillWith
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
danaRPump = DanaRPump(aapsLogger, sp)
|
||||
}
|
||||
}
|
|
@ -1,19 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.TestBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
class DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest : TestBase() {
|
||||
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
class DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest : DanaRSTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.TestBase
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
@ -17,9 +15,8 @@ import java.util.*
|
|||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(RxBusWrapper::class)
|
||||
class DanaRS_Packet_APS_History_EventsTest : TestBase() {
|
||||
class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() {
|
||||
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
|
@ -50,14 +47,6 @@ class DanaRS_Packet_APS_History_EventsTest : TestBase() {
|
|||
Assert.assertEquals("APS_HISTORY_EVENTS", testPacket.friendlyName)
|
||||
}
|
||||
|
||||
fun createArray(length: Int, fillWith: Byte): ByteArray {
|
||||
val ret = ByteArray(length)
|
||||
for (i in 0 until length) {
|
||||
ret[i] = fillWith
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
fun getCalender(from: Long): ByteArray {
|
||||
val cal = GregorianCalendar()
|
||||
if (from != 0L) cal.timeInMillis = from else cal[2000, 0, 1, 0, 0] = 0
|
||||
|
|
|
@ -19,13 +19,7 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
class DanaRS_Packet_APS_Set_Event_HistoryTest {
|
||||
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var danaRSPlugin: DanaRSPlugin
|
||||
class DanaRS_Packet_APS_Set_Event_HistoryTest : DanaRSTestBase() {
|
||||
|
||||
@Test fun runTest() { // test for negative carbs
|
||||
val now = DateUtil.now()
|
||||
|
|
|
@ -1,50 +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.utils.SP;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by Rumen on 01.08.2018
|
||||
*/
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||
public class DanaRS_Packet_Basal_Get_Basal_RateTest {
|
||||
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
|
||||
DanaRS_Packet_Basal_Get_Basal_Rate packet = new DanaRS_Packet_Basal_Get_Basal_Rate();
|
||||
|
||||
// test message decoding
|
||||
// rate is 0.01
|
||||
packet.handleMessage(createArray(100, (byte) 1));
|
||||
assertEquals(false, packet.failed);
|
||||
packet.handleMessage(createArray(100, (byte) 5));
|
||||
assertEquals(true, packet.failed);
|
||||
|
||||
assertEquals("BASAL__GET_BASAL_RATE", packet.getFriendlyName());
|
||||
}
|
||||
|
||||
byte[] createArray(int length, byte fillWith){
|
||||
byte[] ret = new byte[length];
|
||||
for(int i = 0; i<length; i++){
|
||||
ret[i] = fillWith;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(RxBusWrapper::class)
|
||||
class DanaRS_Packet_Basal_Get_Basal_RateTest : DanaRSTestBase() {
|
||||
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)
|
||||
// test message decoding
|
||||
// rate is 0.01
|
||||
packet.handleMessage(createArray(100, 1.toByte()))
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
packet.handleMessage(createArray(100, 5.toByte()))
|
||||
Assert.assertEquals(true, packet.failed)
|
||||
Assert.assertEquals("BASAL__GET_BASAL_RATE", packet.friendlyName)
|
||||
}
|
||||
}
|
|
@ -1,62 +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.utils.SP;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by Rumen on 31.07.2018.
|
||||
*/
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||
public class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest extends DanaRS_Packet_Basal_Get_Profile_Basal_Rate {
|
||||
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
|
||||
// test if pumpRofile array is set right
|
||||
double basal01 = byteArrayToInt(getBytes(createArray(50, (byte) 1), 2, 2)) / 100d;
|
||||
double basal05 = byteArrayToInt(getBytes(createArray(50, (byte) 5), 2, 2)) / 100d;
|
||||
double basal12 = byteArrayToInt(getBytes(createArray(50, (byte) 12), 2, 2)) / 100d;
|
||||
// basal rate > 1U/hr
|
||||
double basal120 = byteArrayToInt(getBytes(createArray(50, (byte) 120), 2, 2)) / 100d;
|
||||
DanaRS_Packet_Basal_Get_Profile_Basal_Rate testPacket = new DanaRS_Packet_Basal_Get_Profile_Basal_Rate(1);
|
||||
byte[] params = testPacket.getRequestParams();
|
||||
assertEquals((byte) 1, params[0]);
|
||||
testPacket.handleMessage(createArray(50, (byte) 0));
|
||||
assertEquals(0.0d, testPacket.pump.pumpProfiles[1][1],0);
|
||||
testPacket.handleMessage(createArray(50, (byte) 1));
|
||||
assertEquals(basal01, testPacket.pump.pumpProfiles[1][2],0);
|
||||
testPacket.handleMessage(createArray(50, (byte) 5));
|
||||
assertEquals(basal05, testPacket.pump.pumpProfiles[1][1],0);
|
||||
testPacket.handleMessage(createArray(50, (byte) 12));
|
||||
assertEquals(basal12, testPacket.pump.pumpProfiles[1][1],0);
|
||||
testPacket.handleMessage(createArray(50, (byte) 120));
|
||||
assertEquals(basal120, testPacket.pump.pumpProfiles[1][1],0);
|
||||
|
||||
assertEquals("BASAL__GET_PROFILE_BASAL_RATE", getFriendlyName());
|
||||
}
|
||||
|
||||
byte[] createArray(int length, byte fillWith){
|
||||
byte[] ret = new byte[length];
|
||||
for(int i = 0; i<length; i++){
|
||||
ret[i] = fillWith;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet.byteArrayToInt
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.comm.DanaRS_Packet.getBytes
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest : DanaRSTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val testPacket = DanaRS_Packet_Basal_Get_Profile_Basal_Rate(aapsLogger, danaRPump, 1)
|
||||
// test if pumpProfile array is set right
|
||||
val basal01 = byteArrayToInt(getBytes(createArray(50, 1.toByte()), 2, 2)) / 100.0
|
||||
val basal05 = byteArrayToInt(getBytes(createArray(50, 5.toByte()), 2, 2)) / 100.0
|
||||
val basal12 = byteArrayToInt(getBytes(createArray(50, 12.toByte()), 2, 2)) / 100.0
|
||||
// basal rate > 1U/hr
|
||||
val basal120 = byteArrayToInt(getBytes(createArray(50, 120.toByte()), 2, 2)) / 100.0
|
||||
val params = testPacket.requestParams
|
||||
assertEquals(1.toByte(), params[0])
|
||||
testPacket.handleMessage(createArray(50, 0.toByte()))
|
||||
assertEquals(0.0, danaRPump.pumpProfiles!![1][1], 0.0)
|
||||
testPacket.handleMessage(createArray(50, 1.toByte()))
|
||||
assertEquals(basal01, danaRPump.pumpProfiles!![1][2], 0.0)
|
||||
testPacket.handleMessage(createArray(50, 5.toByte()))
|
||||
assertEquals(basal05, danaRPump.pumpProfiles!![1][1], 0.0)
|
||||
testPacket.handleMessage(createArray(50, 12.toByte()))
|
||||
assertEquals(basal12, danaRPump.pumpProfiles!![1][1], 0.0)
|
||||
testPacket.handleMessage(createArray(50, 120.toByte()))
|
||||
assertEquals(basal120, danaRPump.pumpProfiles!![1][1], 0.0)
|
||||
assertEquals("BASAL__GET_PROFILE_BASAL_RATE", testPacket.friendlyName)
|
||||
}
|
||||
}
|
|
@ -1,41 +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.utils.SP;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by Rumen on 01.08.2018.
|
||||
*/
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||
public class DanaRS_Packet_Basal_Get_Profile_NumberTest {
|
||||
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
|
||||
DanaRS_Packet_Basal_Get_Profile_Number packet = new DanaRS_Packet_Basal_Get_Profile_Number();
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(new byte[]{(byte) 0, (byte) 0, (byte) 0});
|
||||
assertEquals(false, packet.failed);
|
||||
// if data.length > 4 should return fail
|
||||
|
||||
assertEquals("BASAL__GET_PROFILE_NUMBER", packet.getFriendlyName());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
class DanaRS_Packet_Basal_Get_Profile_NumberTest : DanaRSTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump)
|
||||
// test message decoding
|
||||
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
// if data.length > 4 should return fail
|
||||
Assert.assertEquals("BASAL__GET_PROFILE_NUMBER", packet.friendlyName)
|
||||
}
|
||||
}
|
|
@ -1,49 +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.utils.SP;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by Rumen on 01.08.2018.
|
||||
*/
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||
public class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest {
|
||||
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
|
||||
DanaRS_Packet_Basal_Get_Temporary_Basal_State packet = new DanaRS_Packet_Basal_Get_Temporary_Basal_State();
|
||||
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(50,(byte) 0));
|
||||
assertEquals(false, packet.failed);
|
||||
packet.handleMessage(createArray(50,(byte) 1));
|
||||
assertEquals(true, packet.failed);
|
||||
|
||||
assertEquals("BASAL__TEMPORARY_BASAL_STATE", packet.getFriendlyName());
|
||||
}
|
||||
|
||||
byte[] createArray(int length, byte fillWith) {
|
||||
byte[] ret = new byte[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
ret[i] = fillWith;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() {
|
||||
|
||||
@Test fun runTest() {
|
||||
val packet = DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(50, 0.toByte()))
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
packet.handleMessage(createArray(50, 1.toByte()))
|
||||
Assert.assertEquals(true, packet.failed)
|
||||
Assert.assertEquals("BASAL__TEMPORARY_BASAL_STATE", packet.friendlyName)
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
|||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.TestBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
|
@ -22,11 +21,10 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(RxBusWrapper::class)
|
||||
class DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest : TestBase() {
|
||||
class DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest : DanaRSTestBase() {
|
||||
|
||||
@Mock lateinit var defaultValueHelper: DefaultValueHelper
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
@Mock lateinit var configBuilderPlugin: ConfigBuilderPlugin
|
||||
|
|
|
@ -2,8 +2,6 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
|||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.TestBase
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
|
||||
|
@ -23,11 +21,10 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(RxBusWrapper::class)
|
||||
class DanaRS_Packet_Notify_Delivery_CompleteTest : TestBase() {
|
||||
class DanaRS_Packet_Notify_Delivery_CompleteTest : DanaRSTestBase() {
|
||||
|
||||
@Mock lateinit var defaultValueHelper: DefaultValueHelper
|
||||
@Mock lateinit var rxBus: RxBusWrapper
|
||||
@Mock lateinit var aapsLogger: AAPSLogger
|
||||
@Mock lateinit var resourceHelper: ResourceHelper
|
||||
@Mock lateinit var danaRSPlugin: DanaRSPlugin
|
||||
@Mock lateinit var profileFunction: ProfileFunction
|
||||
|
@ -56,20 +53,4 @@ class DanaRS_Packet_Notify_Delivery_CompleteTest : TestBase() {
|
|||
Assert.assertEquals(true, danaRSPlugin.bolusDone)
|
||||
Assert.assertEquals("NOTIFY__DELIVERY_COMPLETE", packet.friendlyName)
|
||||
}
|
||||
|
||||
fun createArray(length: Int, fillWith: Byte): ByteArray {
|
||||
val ret = ByteArray(length)
|
||||
for (i in 0 until length) {
|
||||
ret[i] = fillWith
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
fun createArray(length: Int, fillWith: Double): DoubleArray {
|
||||
val ret = DoubleArray(length)
|
||||
for (i in 0 until length) {
|
||||
ret[i] = fillWith
|
||||
}
|
||||
return ret
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info
|
||||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import org.junit.Rule
|
||||
import org.mockito.Mockito
|
Loading…
Reference in a new issue