@SuppressWarnings("deprecation")
@Test
public void testParse() throws Exception {

  assertEquals("foo", FOO.parse("", mode));
  assertFailure(mode, FOO, "a", 1, 1, "EOF expected, a encountered.");
  assertFailure(FOO, "a", 1, 1, "test module", "EOF expected, a encountered.");
  assertEquals(new Integer(123), INTEGER.parse(new StringReader("123")));
  try {
    INTEGER.parse(new StringReader("x"), "test module");
    fail();
  } catch (ParserException e) {
    assertEquals(1, e.getLine());
    assertEquals(1, e.getColumn());
    assertTrue(e.getMessage(), e.getMessage().contains("test module"));
    assertTrue(e.getMessage(), e.getMessage().contains("integer expected, x encountered."));
  }
}