Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomershay committed May 18, 2021
1 parent 51625f9 commit c1faab6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,10 @@ public void testAnalyticFunctionWithoutExpression502() throws JSQLParserExceptio
expr.accept(adapter);
}

@Test
public void testAtTimeZoneExpression() throws JSQLParserException {
Expression expr = CCJSqlParserUtil.parseExpression("DATE(date1 AT TIME ZONE 'UTC' AT TIME ZONE 'australia/sydney')");
ExpressionVisitorAdapter adapter = new ExpressionVisitorAdapter();
expr.accept(adapter);
}
}
10 changes: 10 additions & 0 deletions src/test/java/net/sf/jsqlparser/util/TablesNamesFinderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -642,4 +642,14 @@ public void testNPEIssue1009() throws JSQLParserException {

assertThat(tablesNamesFinder.getTableList(stmt)).containsExactly("biz_fund_info");
}

@Test
public void testAtTimeZoneExpression() throws JSQLParserException {
String sql = "SELECT DATE(date1 AT TIME ZONE 'UTC' AT TIME ZONE 'australia/sydney') AS another_date FROM mytbl";
Statement stmt = CCJSqlParserUtil.parse(sql);
TablesNamesFinder tablesNamesFinder = new TablesNamesFinder();
List<String> tableList = tablesNamesFinder.getTableList(stmt);
assertEquals(1, tableList.size());
assertTrue(tableList.contains("mytbl"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,9 @@ public void testAnalyticFunctionFilter() throws JSQLParserException {
EXPRESSIONS);
}


@Test
public void testAtTimeZoneExpression() throws JSQLParserException {
validateNoErrors("SELECT DATE(date1 AT TIME ZONE 'UTC' AT TIME ZONE 'australia/sydney') AS another_date FROM mytbl", 1,
EXPRESSIONS);
}
}

0 comments on commit c1faab6

Please sign in to comment.