ASTSoqlExpression extends AbstractApexNode<SoqlExpression> { public String getQuery() { return node.getRawQuery(); } @Deprecated @InternalApi  ASTSoqlExpression(SoqlExpression soqlExpression); @Override Object jjtAccept(ApexParserVisitor visitor, Object data); String getQuery(); String getCanonicalQuery();  }
@Test public void testQuery() { ApexNode<Compilation> node = parse("class Foo { void test1() { Account acc = [SELECT col FROM Account]; } }"); ASTSoqlExpression soqlExpression = node.getFirstDescendantOfType(ASTSoqlExpression.class); Assert.assertEquals("SELECT col FROM Account", soqlExpression.getQuery()); }