@Test public void testHandleIncomingStatus() { TelegesisFrame frame = new TelegesisFrame(); Method handleIncomingStatus; try { handleIncomingStatus = TelegesisFrame.class.getDeclaredMethod("handleIncomingStatus", new Class[] { int[].class }); handleIncomingStatus.setAccessible(true); assertTrue((boolean) handleIncomingStatus.invoke(frame, stringToIntArray("OK\r\n"))); assertTrue((boolean) handleIncomingStatus.invoke(frame, stringToIntArray("ERROR:20\r\n"))); } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } }
protected boolean handleIncomingStatus(int[] data) { if (Arrays.equals(Arrays.copyOfRange(data, 0, 2), RESPONSE_OK)) { status = TelegesisStatusCode.SUCCESS; return true; } if (Arrays.equals(Arrays.copyOfRange(data, 0, 6), RESPONSE_ERROR)) { StringBuilder builder = new StringBuilder(); builder.append((char) data[6]); builder.append((char) data[7]); status = TelegesisStatusCode.getTelegesisStatusCode(Integer.parseInt(builder.toString(), 16)); return true; } return false; }
TelegesisFrame { protected boolean handleIncomingStatus(int[] data) { if (Arrays.equals(Arrays.copyOfRange(data, 0, 2), RESPONSE_OK)) { status = TelegesisStatusCode.SUCCESS; return true; } if (Arrays.equals(Arrays.copyOfRange(data, 0, 6), RESPONSE_ERROR)) { StringBuilder builder = new StringBuilder(); builder.append((char) data[6]); builder.append((char) data[7]); status = TelegesisStatusCode.getTelegesisStatusCode(Integer.parseInt(builder.toString(), 16)); return true; } return false; } }
TelegesisFrame { protected boolean handleIncomingStatus(int[] data) { if (Arrays.equals(Arrays.copyOfRange(data, 0, 2), RESPONSE_OK)) { status = TelegesisStatusCode.SUCCESS; return true; } if (Arrays.equals(Arrays.copyOfRange(data, 0, 6), RESPONSE_ERROR)) { StringBuilder builder = new StringBuilder(); builder.append((char) data[6]); builder.append((char) data[7]); status = TelegesisStatusCode.getTelegesisStatusCode(Integer.parseInt(builder.toString(), 16)); return true; } return false; }  }
TelegesisFrame { protected boolean handleIncomingStatus(int[] data) { if (Arrays.equals(Arrays.copyOfRange(data, 0, 2), RESPONSE_OK)) { status = TelegesisStatusCode.SUCCESS; return true; } if (Arrays.equals(Arrays.copyOfRange(data, 0, 6), RESPONSE_ERROR)) { StringBuilder builder = new StringBuilder(); builder.append((char) data[6]); builder.append((char) data[7]); status = TelegesisStatusCode.getTelegesisStatusCode(Integer.parseInt(builder.toString(), 16)); return true; } return false; }  TelegesisStatusCode getStatus(); }
TelegesisFrame { protected boolean handleIncomingStatus(int[] data) { if (Arrays.equals(Arrays.copyOfRange(data, 0, 2), RESPONSE_OK)) { status = TelegesisStatusCode.SUCCESS; return true; } if (Arrays.equals(Arrays.copyOfRange(data, 0, 6), RESPONSE_ERROR)) { StringBuilder builder = new StringBuilder(); builder.append((char) data[6]); builder.append((char) data[7]); status = TelegesisStatusCode.getTelegesisStatusCode(Integer.parseInt(builder.toString(), 16)); return true; } return false; }  TelegesisStatusCode getStatus();  }