Skip to content

Commit 3f5dbe1

Browse files
committed
test
1 parent 1292789 commit 3f5dbe1

File tree

2 files changed

+91
-25
lines changed

2 files changed

+91
-25
lines changed

src/test/java/com/codingapi/simplemybatis/parser/SqlParserDemo.java

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package com.codingapi.simplemybatis.parser;
2+
3+
import com.codingapi.simplemybatis.entity.Demo;
4+
import org.junit.jupiter.api.Test;
5+
6+
import java.lang.reflect.InvocationTargetException;
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
10+
class SqlParserTest {
11+
12+
13+
private Demo createDemo(){
14+
Demo demo = new Demo();
15+
demo.setId(1L);
16+
demo.setName("test");
17+
demo.setFlag(false);
18+
demo.setTest("123");
19+
return demo;
20+
}
21+
22+
private SqlParser createSqlParser() throws InvocationTargetException, IllegalAccessException {
23+
Demo demo = createDemo();
24+
TableParser tableParser = new TableParser(demo.getClass());
25+
tableParser.parser(demo);
26+
return new SqlParser(tableParser.getTableInfo());
27+
}
28+
29+
@Test
30+
void createInsertSql() throws InvocationTargetException, IllegalAccessException {
31+
SqlParser sqlParser = createSqlParser();
32+
String sql = sqlParser.createInsertSql();
33+
System.out.println(sql);
34+
}
35+
36+
37+
38+
@Test
39+
void createSelectAll() throws InvocationTargetException, IllegalAccessException {
40+
SqlParser sqlParser = createSqlParser();
41+
String sql = sqlParser.createSelectAll();
42+
System.out.println(sql);
43+
}
44+
45+
46+
47+
@Test
48+
void createUpdateSql() throws InvocationTargetException, IllegalAccessException {
49+
SqlParser sqlParser = createSqlParser();
50+
String sql = sqlParser.createUpdateSql();
51+
System.out.println(sql);
52+
}
53+
54+
@Test
55+
void createDeleteSql() throws InvocationTargetException, IllegalAccessException {
56+
SqlParser sqlParser = createSqlParser();
57+
String sql = sqlParser.createDeleteSql();
58+
System.out.println(sql);
59+
}
60+
61+
@Test
62+
void createInsertAllSql() throws InvocationTargetException, IllegalAccessException {
63+
SqlParser sqlParser = createSqlParser();
64+
List<Demo> list = new ArrayList<>();
65+
list.add(createDemo());
66+
list.add(createDemo());
67+
String sql = sqlParser.createInsertAllSql(list);
68+
System.out.println(sql);
69+
}
70+
71+
@Test
72+
void createDeleteAllSql() throws InvocationTargetException, IllegalAccessException {
73+
SqlParser sqlParser = createSqlParser();
74+
String sql = sqlParser.createDeleteAllSql();
75+
System.out.println(sql);
76+
}
77+
78+
@Test
79+
void createDeleteAllByIdSql() throws InvocationTargetException, IllegalAccessException {
80+
SqlParser sqlParser = createSqlParser();
81+
String sql = sqlParser.createDeleteAllByIdSql();
82+
System.out.println(sql);
83+
}
84+
85+
@Test
86+
void createGetByIdSql() throws InvocationTargetException, IllegalAccessException {
87+
SqlParser sqlParser = createSqlParser();
88+
String sql = sqlParser.createGetByIdSql();
89+
System.out.println(sql);
90+
}
91+
}

0 commit comments

Comments
 (0)