|
9 | 9 | */ |
10 | 10 | package net.sf.jsqlparser.util; |
11 | 11 |
|
12 | | -import java.io.BufferedReader; |
13 | | -import java.io.InputStreamReader; |
14 | | -import java.io.StringReader; |
15 | | -import java.util.Iterator; |
16 | | -import java.util.List; |
17 | 12 | import net.sf.jsqlparser.JSQLParserException; |
18 | 13 | import net.sf.jsqlparser.expression.Expression; |
19 | 14 | import net.sf.jsqlparser.expression.OracleHint; |
|
34 | 29 | import net.sf.jsqlparser.statement.update.Update; |
35 | 30 | import net.sf.jsqlparser.statement.upsert.Upsert; |
36 | 31 | import net.sf.jsqlparser.test.TestException; |
37 | | -import static org.junit.Assert.*; |
38 | 32 | import org.junit.Test; |
39 | 33 |
|
| 34 | +import java.io.BufferedReader; |
| 35 | +import java.io.InputStreamReader; |
| 36 | +import java.io.StringReader; |
| 37 | +import java.util.Iterator; |
| 38 | +import java.util.List; |
| 39 | + |
| 40 | +import static org.assertj.core.api.Assertions.assertThatThrownBy; |
| 41 | +import static org.junit.Assert.*; |
| 42 | + |
40 | 43 | public class TablesNamesFinderTest { |
41 | 44 |
|
42 | 45 | private static CCJSqlParserManager pm = new CCJSqlParserManager(); |
@@ -594,4 +597,22 @@ public void testRemoteLink() throws JSQLParserException { |
594 | 597 | assertEquals(1, tableList.size()); |
595 | 598 | assertTrue(tableList.contains("table1@remote")); |
596 | 599 | } |
| 600 | + |
| 601 | + @Test |
| 602 | + public void testCreateSequence_throwsException() throws JSQLParserException { |
| 603 | + String sql = "CREATE SEQUENCE my_seq"; |
| 604 | + Statement stmt = CCJSqlParserUtil.parse(sql); |
| 605 | + TablesNamesFinder tablesNamesFinder = new TablesNamesFinder(); |
| 606 | + assertThatThrownBy(() -> tablesNamesFinder.getTableList(stmt)).isInstanceOf(UnsupportedOperationException.class) |
| 607 | + .hasMessage("Finding tables from CreateSequence is not supported"); |
| 608 | + } |
| 609 | + |
| 610 | + @Test |
| 611 | + public void testAlterSequence_throwsException() throws JSQLParserException { |
| 612 | + String sql = "ALTER SEQUENCE my_seq"; |
| 613 | + Statement stmt = CCJSqlParserUtil.parse(sql); |
| 614 | + TablesNamesFinder tablesNamesFinder = new TablesNamesFinder(); |
| 615 | + assertThatThrownBy(() -> tablesNamesFinder.getTableList(stmt)).isInstanceOf(UnsupportedOperationException.class) |
| 616 | + .hasMessage("Finding tables from AlterSequence is not supported"); |
| 617 | + } |
597 | 618 | } |
0 commit comments