### Question:
ReaderCharacterSource implements CharacterSource { @Override public final boolean consumeIfMatch( char[] match ) { try { char [] _chars = readBuf; int i=0; int idx = index; boolean ok = true; if ( idx + match.length > length ) { readForToken (); } for (; i < match.length; i++, idx++) { ok &= ( match[i] == _chars[idx] ); if (!ok) break; } if ( ok ) { index = idx; return true; } else { return false; } } catch (Exception ex) { String str = CharScanner.errorDetails ( "consumeIfMatch issue", readBuf, index, ch ); return Exceptions.handle ( boolean.class, str, ex ); } } ReaderCharacterSource( final Reader reader, final int readAheadSize);  ReaderCharacterSource( final Reader reader );  ReaderCharacterSource( final String string ); @Override final int nextChar(); @Override final int currentChar(); @Override final boolean hasChar(); @Override final boolean consumeIfMatch( char[] match ); @Override final int location(); final int safeNextChar(); @Override final char[] findNextChar( int match, int esc ); final char[] findNextChar( boolean inMiddleOfString, boolean wasEscapeChar, int match, int esc ); @Override boolean hadEscape(); @Override void skipWhiteSpace(); char[] readNumber(  ); @Override String errorDetails( String message );  }### Answer:
@Test public void consumeIfMatchTest() { String testString = "abc true abc"; initSourceWithString(testString); boolean found = false; loop: while (source.hasChar()) { int i = source.currentChar(); switch ( i ) { case 't': found = true; break loop; } source.nextChar(); } boolean ok = found || die("not found"); ok |= source.consumeIfMatch ( "true".toCharArray() ) || die(); ok |= source.safeNextChar () == ' ' || die("" + (char)source.safeNextChar ()); }