/**
* Pass in a parse tree that has exactly one equality predicate with the right hand operand being the expected literal
*/
private void validateDateTimeLiteralInEqualityPredicate(HqlParser parser, DateTimeLiteralType expectedType) {
Collection<ParseTree> predicates = XPath.findAll( parser.statement(), "//predicate", parser );
assertEquals( 1, predicates.size() );
EqualityPredicateContext predicate = (EqualityPredicateContext) predicates.iterator().next();
// predicate[1] -> the literal
assertTrue( predicate.expression( 1 ) instanceof LiteralExpressionContext );
LiteralExpressionContext lec = (LiteralExpressionContext) predicate.expression( 1 );
DateTimeLiteralType found = lec.literal().accept( new DateTimeLiteralCategorizingVisitor() );
assertEquals( expectedType, found );
}
HqlParserTest.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:hibernate-semantic-query
作者:
评论列表
文章目录