@Test(expected = Exception.class) public void testNotHavingEnoughDataToParseThrowsException() { final List<Byte> packet = new ArrayList<>( singletonList((byte) 0x01) ); converter.consume(packet); }
@Override public Integer consume(@NonNull List<Byte> packet) { final int mostSigBits = packet.remove(0); final int leastSigBits = packet.remove(0); return (mostSigBits & 0xff) * 0x100 + (leastSigBits & 0xff); }
IntegerFieldConverter implements IFieldConverter<Integer> { @Override public Integer consume(@NonNull List<Byte> packet) { final int mostSigBits = packet.remove(0); final int leastSigBits = packet.remove(0); return (mostSigBits & 0xff) * 0x100 + (leastSigBits & 0xff); } }
IntegerFieldConverter implements IFieldConverter<Integer> { @Override public Integer consume(@NonNull List<Byte> packet) { final int mostSigBits = packet.remove(0); final int leastSigBits = packet.remove(0); return (mostSigBits & 0xff) * 0x100 + (leastSigBits & 0xff); }  }
IntegerFieldConverter implements IFieldConverter<Integer> { @Override public Integer consume(@NonNull List<Byte> packet) { final int mostSigBits = packet.remove(0); final int leastSigBits = packet.remove(0); return (mostSigBits & 0xff) * 0x100 + (leastSigBits & 0xff); }  @Override Integer consume(@NonNull List<Byte> packet); @Override void insert(@NonNull List<Byte> packet, @NonNull Object value); @Override void insertMask(@NonNull List<Byte> packet, byte maskBit); @Override boolean canParse(@NonNull Class<?> clazz); @Override boolean canParse(int numberOfBytes); }
IntegerFieldConverter implements IFieldConverter<Integer> { @Override public Integer consume(@NonNull List<Byte> packet) { final int mostSigBits = packet.remove(0); final int leastSigBits = packet.remove(0); return (mostSigBits & 0xff) * 0x100 + (leastSigBits & 0xff); }  @Override Integer consume(@NonNull List<Byte> packet); @Override void insert(@NonNull List<Byte> packet, @NonNull Object value); @Override void insertMask(@NonNull List<Byte> packet, byte maskBit); @Override boolean canParse(@NonNull Class<?> clazz); @Override boolean canParse(int numberOfBytes);  }