### Question:
CharacterReader { private void bufferUp() { final int pos = bufPos; if (pos < bufSplitPoint) return; try { reader.skip(pos); reader.mark(maxBufferLen); final int read = reader.read(charBuf); reader.reset(); if (read != -1) { bufLength = read; readerPos += pos; bufPos = 0; bufMark = -1; bufSplitPoint = bufLength > readAheadLimit ? readAheadLimit : bufLength; } } catch (IOException e) { throw new UncheckedIOException(e); } } CharacterReader(Reader input, int sz);  CharacterReader(Reader input);  CharacterReader(String input); int pos(); boolean isEmpty(); char current(); void advance(); String consumeTo(char c); String consumeToAny(final char... chars); @Override String toString();  }### Answer:
@Test public void bufferUp() { String note = "HelloThere"; int loopCount = 64; StringBuilder sb = new StringBuilder(); for (int i = 0; i < loopCount; i++) { sb.append(note); sb.append("!"); } String s = sb.toString(); BufferedReader br = new BufferedReader(new StringReader(s)); CharacterReader r = new CharacterReader(br); for (int i = 0; i < loopCount; i++) { String pull = r.consumeTo('!'); assertEquals(note, pull); assertEquals('!', r.current()); r.advance(); } assertTrue(r.isEmpty()); }