MsgSetTime extends MessageBase { public void handleMessage(byte[] bytes) { int result = intFromBuff(bytes, 0, 1); if (result != 1) { failed = true; } if (L.isEnabled(L.PUMPCOMM)) log.debug("Result of setting time: " + time + " is " + result); } MsgSetTime(Date time); void handleMessage(byte[] bytes);  }
@Test public void runTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); AAPSMocker.mockL(); MsgSetTime packet = new MsgSetTime(new Date(System.currentTimeMillis())); packet.handleMessage(createArray(34, (byte) 7)); assertEquals(true, packet.failed); }