MsgSettingMaxValues extends MessageBase { public void handleMessage(byte[] bytes) { DanaRPump pump = DanaRPump.getInstance(); pump.maxBolus = intFromBuff(bytes, 0, 2) / 100d; pump.maxBasal = intFromBuff(bytes, 2, 2) / 100d; pump.maxDailyTotalUnits = intFromBuff(bytes, 4, 2) / 100; if (L.isEnabled(L.PUMPCOMM)) { log.debug("Max bolus: " + pump.maxBolus); log.debug("Max basal: " + pump.maxBasal); log.debug("Total daily max units: " + pump.maxDailyTotalUnits); } } MsgSettingMaxValues(); void handleMessage(byte[] bytes);  }
@Test public void runTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); AAPSMocker.mockL(); MsgSettingMaxValues packet = new MsgSettingMaxValues(); packet.handleMessage(createArray(34, (byte) 7)); DanaRPump pump = DanaRPump.getInstance(); assertEquals((double) MessageBase.intFromBuff(createArray(10, (byte) 7), 0, 2) / 100d, pump.maxBolus,0); }