MsgInitConnStatusOption extends MessageBase { @Override public void handleMessage(byte[] bytes) { int status1224Clock = intFromBuff(bytes, 0, 1); int isStatusButtonScroll = intFromBuff(bytes, 1, 1); int soundVibration = intFromBuff(bytes, 2, 1); int glucoseUnit = intFromBuff(bytes, 3, 1); int lcdTimeout = intFromBuff(bytes, 4, 1); int backlightgTimeout = intFromBuff(bytes, 5, 1); int languageOption = intFromBuff(bytes, 6, 1); int lowReservoirAlarmBoundary = intFromBuff(bytes, 7, 1); if (bytes.length >= 21) { DanaRPump.getInstance().password = intFromBuff(bytes, 9, 2) ^ 0x3463; if (L.isEnabled(L.PUMPCOMM)) log.debug("Pump password: " + DanaRPump.getInstance().password); } else { failed = true; } if (!DanaRPump.getInstance().isPasswordOK()) { Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT); RxBus.INSTANCE.send(new EventNewNotification(notification)); } else { RxBus.INSTANCE.send(new EventDismissNotification(Notification.WRONG_PUMP_PASSWORD)); } if (ConfigBuilderPlugin.getPlugin().getActivePump() != null) ConfigBuilderPlugin.getPlugin().getActivePump().finishHandshaking(); } MsgInitConnStatusOption(); @Override void handleMessage(byte[] bytes);  }
@Test public void runTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); AAPSMocker.mockL(); AAPSMocker.mockConfigBuilder(); MsgInitConnStatusOption packet = new MsgInitConnStatusOption(); packet.handleMessage(createArray(20, (byte) 1)); assertEquals(true, packet.failed); packet.handleMessage(createArray(22, (byte) 1)); DanaRPump pump = DanaRPump.getInstance(); assertEquals(false, pump.isPasswordOK()); }