use of org.eclipse.xtext.parser.IParser in project xtext-core by eclipse.
the class ParseErrorHandlingTest method testExpectNoSuchMethodException.
@Test
public void testExpectNoSuchMethodException() throws Exception {
IParser parser = get(IParser.class);
ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
parserRule.setName("ruleDoesNotExist");
try {
parser.parse(parserRule, new StringReader("empty"));
fail("Expected WrappedException");
} catch (ParseException e) {
assertTrue(e.getCause() instanceof WrappedException);
WrappedException cause = (WrappedException) e.getCause();
assertTrue(cause.getCause() instanceof NoSuchMethodException);
}
}
Aggregations