@Test(expected = ParserException.class) public void testParseSingleByteFieldNegative() { parser.parseByteField(-123); }
protected byte parseByteField(int length) { if (length == 0) { throw new ParserException("Cannot parse byte of size 0"); } if (length > 1) { LOGGER.warn("Parsing byte[] field into a byte of size >1"); } return (byte) ArrayConverter.bytesToInt(parseByteArrayField(length)); }
Parser { protected byte parseByteField(int length) { if (length == 0) { throw new ParserException("Cannot parse byte of size 0"); } if (length > 1) { LOGGER.warn("Parsing byte[] field into a byte of size >1"); } return (byte) ArrayConverter.bytesToInt(parseByteArrayField(length)); } }
Parser { protected byte parseByteField(int length) { if (length == 0) { throw new ParserException("Cannot parse byte of size 0"); } if (length > 1) { LOGGER.warn("Parsing byte[] field into a byte of size >1"); } return (byte) ArrayConverter.bytesToInt(parseByteArrayField(length)); } Parser(int startposition, byte[] array); }
Parser { protected byte parseByteField(int length) { if (length == 0) { throw new ParserException("Cannot parse byte of size 0"); } if (length > 1) { LOGGER.warn("Parsing byte[] field into a byte of size >1"); } return (byte) ArrayConverter.bytesToInt(parseByteArrayField(length)); } Parser(int startposition, byte[] array); int getPointer(); void setPointer(int pointer); int getStartPoint(); abstract T parse(); }
Parser { protected byte parseByteField(int length) { if (length == 0) { throw new ParserException("Cannot parse byte of size 0"); } if (length > 1) { LOGGER.warn("Parsing byte[] field into a byte of size >1"); } return (byte) ArrayConverter.bytesToInt(parseByteArrayField(length)); } Parser(int startposition, byte[] array); int getPointer(); void setPointer(int pointer); int getStartPoint(); abstract T parse();  }