Parser { protected boolean enoughBytesLeft(int count) { return getBytesLeft() >= count; } Parser(int startposition, byte[] array); int getPointer(); void setPointer(int pointer); int getStartPoint(); abstract T parse();  }
@Test public void testEnoughBytesLeft() { assertTrue(parser.enoughBytesLeft(9)); assertFalse(parser.enoughBytesLeft(10)); assertTrue(parser.enoughBytesLeft(1)); parser.parseByteArrayField(7); assertFalse(parser.enoughBytesLeft(9)); assertTrue(parser.enoughBytesLeft(2)); assertTrue(parser.enoughBytesLeft(1)); }