MsgSettingShippingInfo extends MessageBase { public void handleMessage(byte[] bytes) { DanaRPump pump = DanaRPump.getInstance(); pump.serialNumber = stringFromBuff(bytes, 0, 10); pump.shippingDate = dateFromBuff(bytes, 10); pump.shippingCountry = asciiStringFromBuff(bytes, 13, 3); if (L.isEnabled(L.PUMPCOMM)) { log.debug("Serial number: " + pump.serialNumber); log.debug("Shipping date: " + pump.shippingDate); log.debug("Shipping country: " + pump.shippingCountry); } } MsgSettingShippingInfo(); void handleMessage(byte[] bytes);  }
@Test public void runTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); AAPSMocker.mockL(); MsgSettingShippingInfo packet = new MsgSettingShippingInfo(); DanaRPump pump = DanaRPump.getInstance(); pump.units = DanaRPump.UNITS_MGDL; packet.handleMessage(createArray(34, (byte) 7)); pump = DanaRPump.getInstance(); assertEquals(MessageBase.stringFromBuff(createArray(34, (byte) 7), 0, 10), pump.serialNumber); }