### Question:
Bufferlo implements CharSequence { public int indexOf(String regex) { Matcher matcher = Pattern.compile(regex).matcher(this); if(!matcher.find()) return -1; return matcher.start(); }  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 testIndexOf() { try { Bufferlo parser = getBufferlo("hello world"); int worldIndex = parser.indexOf("w"); assertEquals(6, worldIndex); assertEquals("hello world", parser.toString()); } catch(IOException e) { fail(e.getMessage()); } }
@Test public void testIndexOfBadInput() { try { Bufferlo parser = getBufferlo("hello world"); int tIndex = parser.indexOf("t"); assertEquals(-1, tIndex); } catch(IOException e) { fail(e.getMessage()); } }