### Question:
JPQLParser { public Start parse(String stmt) throws Exception { Parser p = new Parser(new Lexer(new PushbackReader(new StringReader(stmt)))); Start start = p.parse(); return start; }  Start parse(String stmt);  }### Answer:
@Test public void testStartSpeed() throws Exception { parser.parse("select a from A as a"); }
@Test public void testJPQL() throws Exception { parser.parse("select a from A as a where a.f='str'"); parser.parse("select a from A as a where a.f=\"str\""); parser.parse("select doc from Document doc, doc.object(XWiki.XWikiGroups) as g order by g.number"); parser.parse("select doc from Document doc, doc.object(XWiki.XWikiGroups) as g order by g.number desc"); parser.parse("select doc from Document doc, doc.object(XWiki.XWikiGroups) as g order by g.number asc"); parser.parse("select doc from Document doc, doc.object(XWiki.XWikiGroups) as g order by 1 asc"); parser.parse("select doc.XWD_FULLNAME from Document doc group by doc.XWD_FULLNAME"); parser.parse("select doc.XWD_FULLNAME from Document doc group by 1"); parser.parse("select a from A as a where :param member of a.prop"); parser.parse("select a from A as a where a.p = ?1 or :name = a.p or ?2 member of a.p or a.p like :qwe"); }
@Test public void testXWQLExtensions() throws Exception { parser.parse("select doc from Document as doc, doc.object('XWiki.Test') as test where test.some=1"); parser.parse("select doc from Document as doc, doc.object(XWiki.Test) as test where test.some=1"); parser.parse("select doc from Document as doc where doc.object('XWiki.Test').prop=1"); parser.parse("select doc from Document as doc where doc.object(XWiki.Test).prop=1"); }
@Test public void parseMethodsInLike() throws Exception { this.parser.parse("SELECT doc.fullName FROM Document doc, doc.object(XWiki.XWikiUsers) obj " + "where obj.first_name like LOWER('%DMIN%')"); this.parser.parse("SELECT doc.fullName FROM Document doc, doc.object(XWiki.XWikiUsers) obj " + "where obj.first_name like LOWER(CONCAT('%', 'DMIN%'))"); }