MsgSettingGlucose extends MessageBase { public void handleMessage(byte[] bytes) { DanaRPump pump = DanaRPump.getInstance(); pump.units = intFromBuff(bytes, 0, 1); pump.easyBasalMode = intFromBuff(bytes, 1, 1); if (L.isEnabled(L.PUMPCOMM)) { log.debug("Pump units: " + (pump.units == DanaRPump.UNITS_MGDL ? "MGDL" : "MMOL")); log.debug("Easy basal mode: " + pump.easyBasalMode); } } MsgSettingGlucose(); void handleMessage(byte[] bytes);  }
@Test public void runTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); AAPSMocker.mockL(); MsgSettingGlucose packet = new MsgSettingGlucose(); packet.handleMessage(createArray(34, (byte) 1)); DanaRPump pump = DanaRPump.getInstance(); assertEquals(1, pump.units); }