### Question:
Bufferlo implements CharSequence { public Bufferlo consume(int bytes) { assert(bytes >= 0 && bytes <= length()); Bufferlo result = duplicate(); result.limit(bytes); skip(bytes); return result; }  void clear(); int readFromChannel(ReadableByteChannel source); int readFromChannel(ReadableByteChannel source, int bytesRequested); long writeToChannel(GatheringByteChannel target); long writeToChannel(GatheringByteChannel target, SelectionKey selectionKey); byte[] consumeBytes(int bytes); BufferloInputStream getInputStream(); BufferloOutputStream getOutputStream(); Bufferlo duplicate(); Bufferlo consume(int bytes); void write(String data); static final ByteBuffer stringToBytes(String in); Bufferlo append(Bufferlo data); Bufferlo append(ByteBuffer data); void limit(int bytes); void skip(int bytes); @Override int length(); @Override char charAt(int index); @Override CharSequence subSequence(int start, int end); @Override String toString(); String toDebugString(); int indexOf(String regex); int consume(String regex); String readUntil(String regex); String readUntil(String regex, boolean consume);  }### Answer:
@Test public void testConsume() { try { Bufferlo parser = getBufferlo("hello world"); parser.consume("hell"); assertEquals("o world", parser.toString()); parser.consume("[a-z]\\s[a-z]"); assertEquals("orld", parser.toString()); parser.consume("orld"); assertEquals("", parser.toString()); } catch(ParseException e) { fail(e.getMessage()); } catch(IOException e) { fail(e.getMessage()); } }
@Test public void testConsumeBadInput() { try { Bufferlo parser = getBufferlo("hello world"); parser.consume("earth"); fail(); } catch(ParseException e) { } catch(IOException e) { fail(e.getMessage()); } }
@Test public void testConsumeNotAtStart() { try { Bufferlo parser = getBufferlo("hello world"); parser.consume("ello"); fail(); } catch(ParseException e) { } catch(IOException e) { fail(e.getMessage()); } }