CharacterReader { int nextIndexOf(char c) { for (int i = pos; i < length; i++) { if (c == input[i]) return i - pos; } return -1; } CharacterReader(String input); @Override String toString();  }
@Test public void nextIndexOfUnmatched() { CharacterReader r = new CharacterReader("<[[one]]"); assertEquals(-1, r.nextIndexOf("]]>")); }