|
@@ -24,12 +24,13 @@ import net.sf.jsqlparser.statement.update.Update;
|
|
|
import org.junit.jupiter.api.Assertions;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
+import static org.assertj.core.api.Assertions.assertThat;
|
|
|
+
|
|
|
/**
|
|
|
* SQL 解析测试
|
|
|
*/
|
|
|
class JSqlParserTest {
|
|
|
|
|
|
-
|
|
|
@Test
|
|
|
void parser() throws Exception {
|
|
|
Select select = (Select) CCJSqlParserUtil.parse("SELECT a,b,c FROM tableName t WHERE t.col = 9 and b=c LIMIT 3, ?");
|
|
@@ -43,6 +44,13 @@ class JSqlParserTest {
|
|
|
System.out.println(e.getLeftExpression());
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void notLikeParser() throws Exception {
|
|
|
+ final String targetSql = "SELECT * FROM tableName WHERE id NOT LIKE ?";
|
|
|
+ Select select = (Select) CCJSqlParserUtil.parse(targetSql);
|
|
|
+ assertThat(select.toString()).isEqualTo(targetSql);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Test
|
|
|
void updateWhereParser() throws Exception {
|