@Test public void syntax_exception() { Condition<ParseException> hasCorrectPosition = new Condition<>(e -> e.getPosition() != null && e.getPosition().line() == 2 && e.getPosition().lineOffset() == 0, ""); assertThatThrownBy(() -> converter.parse("true\nend")) .isInstanceOf(ParseException.class) .hasMessage("(SyntaxError) unexpected token kEND") .matches(e -> hasCorrectPosition.matches((ParseException) e)); }
@Override public Tree parse(String content) { try { return parseContent(content); } catch (StandardError e) { throw new ParseException(e.getMessage(), getErrorLocation(e), e); } catch (Exception e) { throw new ParseException(e.getMessage(), null, e); } }
RubyConverter implements ASTConverter { @Override public Tree parse(String content) { try { return parseContent(content); } catch (StandardError e) { throw new ParseException(e.getMessage(), getErrorLocation(e), e); } catch (Exception e) { throw new ParseException(e.getMessage(), null, e); } } }
RubyConverter implements ASTConverter { @Override public Tree parse(String content) { try { return parseContent(content); } catch (StandardError e) { throw new ParseException(e.getMessage(), getErrorLocation(e), e); } catch (Exception e) { throw new ParseException(e.getMessage(), null, e); } } RubyConverter(RubyRuntimeAdapter rubyRuntimeAdapter);  RubyConverter(); }
RubyConverter implements ASTConverter { @Override public Tree parse(String content) { try { return parseContent(content); } catch (StandardError e) { throw new ParseException(e.getMessage(), getErrorLocation(e), e); } catch (Exception e) { throw new ParseException(e.getMessage(), null, e); } } RubyConverter(RubyRuntimeAdapter rubyRuntimeAdapter);  RubyConverter(); @Override void terminate(); @Override Tree parse(String content); }
RubyConverter implements ASTConverter { @Override public Tree parse(String content) { try { return parseContent(content); } catch (StandardError e) { throw new ParseException(e.getMessage(), getErrorLocation(e), e); } catch (Exception e) { throw new ParseException(e.getMessage(), null, e); } } RubyConverter(RubyRuntimeAdapter rubyRuntimeAdapter);  RubyConverter(); @Override void terminate(); @Override Tree parse(String content);  }