MsgSetBasalProfile extends MessageBase { @Override public void handleMessage(byte[] bytes) { int result = intFromBuff(bytes, 0, 1); if (result != 1) { failed = true; if (L.isEnabled(L.PUMPCOMM)) log.debug("Set basal profile result: " + result + " FAILED!!!"); Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT); RxBus.INSTANCE.send(new EventNewNotification(reportFail)); } else { if (L.isEnabled(L.PUMPCOMM)) log.debug("Set basal profile result: " + result); Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60); RxBus.INSTANCE.send(new EventNewNotification(reportOK)); } } MsgSetBasalProfile();  MsgSetBasalProfile(byte index, double[] values); @Override void handleMessage(byte[] bytes);  }
@Test public void runTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); AAPSMocker.mockL(); MsgSetBasalProfile packet = new MsgSetBasalProfile((byte) 1, createArray(24,1)); packet.handleMessage(createArray(34, (byte) 2)); assertEquals(true, packet.failed); }