### Question:
IntField extends AbstractField<Integer> { @Override public byte[] getBytes() { return String.valueOf(value).getBytes(US_ASCII); } protected  IntField(int tagNum, byte[] bytes, int offset, int length); protected  IntField(int tagNum, int value); @Override Integer getValue(); @Override byte[] getBytes(); int intValue(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testGetBytes() { int value = new Random().nextInt(); int tag = new Random().nextInt(); IntField field = new IntField(tag, value); byte[] bytes = field.getBytes(); assertArrayEquals(String.valueOf(value).getBytes(US_ASCII), bytes); }
@Test(expected = ParseException.class) public void testFailParseNonInteger() throws ParseException { new IntField(10, "12a345".getBytes(US_ASCII), 0, 6); }