private void assertTrimFunction(
          ASTNode tree, String expectedFunctionName, String expectedStringToTrim, String expectedTrimChars) {
    ASTNode functionNode = assertTrimFunction(tree, expectedFunctionName, expectedStringToTrim, 3);

    ASTNode trimCharacters = (ASTNode) functionNode.getChild(2);
    assertEquals(HiveParser.StringLiteral, trimCharacters.getType());
    assertEquals(expectedTrimChars, trimCharacters.getText());
  }
Test cases for parse WITHIN GROUP clause syntax.
function(expression) WITHIN GROUP (ORDER BY sort_expression)
parser/src/test/org/apache/hadoop/hive/ql/parse/TestParseTrim.java