### Question:
Bufferlo implements CharSequence { public String readUntil(String regex) throws ParseException { return readUntil(regex, true); }  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 testReadUntil() { try { Bufferlo parser = getBufferlo("hello world"); String hello = parser.readUntil("\\s"); assertEquals("hello", hello); assertEquals("world", parser.toString()); String worl = parser.readUntil("[abcde]+"); assertEquals("worl", worl); assertEquals("", parser.toString()); } catch(ParseException e) { fail(e.getMessage()); } catch(IOException e) { fail(e.getMessage()); } }
@Test public void testReadUntilBadInput() { try { Bufferlo parser = getBufferlo("hello world"); parser.readUntil("earth"); fail(); } catch(ParseException e) { } catch(IOException e) { fail(e.getMessage()); } }