TableConfigurationPlugin 测试用例
This commit is contained in:
+12
-1
@@ -53,7 +53,9 @@ public class TableConfigurationPluginTest {
|
||||
MyBatisGenerator myBatisGenerator = tool.generate();
|
||||
for (GeneratedJavaFile file : myBatisGenerator.getGeneratedJavaFiles()){
|
||||
String name = file.getCompilationUnit().getType().getShortName();
|
||||
Assert.assertTrue(name.matches("Testb.*"));
|
||||
if (!(name.matches("Testb.*") || name.matches("TbBlobs.*"))){
|
||||
Assert.assertTrue(false);
|
||||
}
|
||||
}
|
||||
// 执行一条语句确认其可用
|
||||
tool.generate(() -> DBHelper.resetDB("scripts/TableConfigurationPlugin/init.sql"), new AbstractShellCallback() {
|
||||
@@ -93,6 +95,15 @@ public class TableConfigurationPluginTest {
|
||||
}
|
||||
Assert.assertEquals(count, 3);
|
||||
}
|
||||
if (file.getFileName().equals("TbBlobs.java")){
|
||||
int count = 0;
|
||||
for (Field field : ((TopLevelClass)(file.getCompilationUnit())).getFields()){
|
||||
if (field.getName().startsWith("increment")){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
Assert.assertEquals(count, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// 执行一条语句确认其可用
|
||||
|
||||
+4
-1
@@ -52,6 +52,9 @@
|
||||
<table tableName="tb">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
</table>
|
||||
<table tableName="tb_keys"/>
|
||||
<table tableName="tb_blobs">
|
||||
<property name="columnRenamingRule.disable" value="true"/>
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
</table>
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
+4
@@ -52,5 +52,9 @@
|
||||
<table tableName="tb">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
</table>
|
||||
<table tableName="tb_blobs">
|
||||
<property name="domainObjectRenamingRule.disable" value="true"/>
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
</table>
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
Reference in New Issue
Block a user