BaseParser { protected final char pop() throws ParserException { if (available()) { if (toParse.charAt(currentPosition) == '\n') { currentLine++; } return toParse.charAt(currentPosition++); } else { die("Unexpected EOF"); return 0; } } BaseParser(String toParse); final boolean available(); final void skipWhitespaces(); final void skipComments();  }
@Test(expected = ParserException.class) public void testPopException() throws ParserException { BaseParser parser = new BaseParser("a"); parser.pop(); parser.pop(); }