diff --git a/src/test/java/com/itfsw/mybatis/generator/plugins/CommentPluginTest.java b/src/test/java/com/itfsw/mybatis/generator/plugins/CommentPluginTest.java
index 2630ef4..f971192 100644
--- a/src/test/java/com/itfsw/mybatis/generator/plugins/CommentPluginTest.java
+++ b/src/test/java/com/itfsw/mybatis/generator/plugins/CommentPluginTest.java
@@ -51,7 +51,7 @@ public class CommentPluginTest {
*/
@BeforeClass
public static void init() throws Exception {
- DBHelper.createDB("scripts/ComentPlugin/init.sql");
+ DBHelper.createDB("scripts/CommentPlugin/init.sql");
}
/**
@@ -59,7 +59,7 @@ public class CommentPluginTest {
*/
@Test
public void testGenerateWithoutTemplate() throws Exception {
- MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/ComentPlugin/mybatis-generator-without-template.xml");
+ MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/CommentPlugin/mybatis-generator-without-template.xml");
MyBatisGenerator myBatisGenerator = tool.generate();
// 是否在使用系统默认模板
int count = 0;
@@ -76,7 +76,7 @@ public class CommentPluginTest {
*/
@Test
public void testGenerateWithTemplate() throws Exception {
- MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/ComentPlugin/mybatis-generator.xml");
+ MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/CommentPlugin/mybatis-generator.xml");
MyBatisGenerator myBatisGenerator = tool.generate();
// java中的注释
@@ -105,4 +105,31 @@ public class CommentPluginTest {
String comment = ((TextElement) els.get(0)).getContent();
Assert.assertEquals(comment, "addComment:BaseResultMap");
}
+
+ /**
+ * 测试配置了模板参数转换
+ */
+ @Test
+ public void testGenerateWithOutComment() throws Exception {
+ MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/CommentPlugin/mybatis-generator-without-comment.xml");
+ MyBatisGenerator myBatisGenerator = tool.generate();
+
+ // java中的注释
+ for (GeneratedJavaFile file : myBatisGenerator.getGeneratedJavaFiles()) {
+ if (file.getFileName().equals("Tb.java")) {
+ TopLevelClass topLevelClass = (TopLevelClass) file.getCompilationUnit();
+ // addJavaFileComment
+ Assert.assertEquals(topLevelClass.getFileCommentLines().size(), 0);
+ // addFieldComment
+ Field id = topLevelClass.getFields().get(0);
+ Assert.assertEquals(id.getJavaDocLines().size(), 0);
+ // addGeneralMethodComment
+ Method cons = topLevelClass.getMethods().get(0);
+ Assert.assertEquals(cons.getJavaDocLines().size(), 0);
+ // addSetterComment
+ Method setter = topLevelClass.getMethods().get(5);
+ Assert.assertEquals(setter.getJavaDocLines().size(), 0);
+ }
+ }
+ }
}
diff --git a/src/test/resources/scripts/ComentPlugin/init.sql b/src/test/resources/scripts/CommentPlugin/init.sql
similarity index 100%
rename from src/test/resources/scripts/ComentPlugin/init.sql
rename to src/test/resources/scripts/CommentPlugin/init.sql
diff --git a/src/test/resources/scripts/CommentPlugin/mybatis-generator-without-comment.xml b/src/test/resources/scripts/CommentPlugin/mybatis-generator-without-comment.xml
new file mode 100644
index 0000000..e1a92b9
--- /dev/null
+++ b/src/test/resources/scripts/CommentPlugin/mybatis-generator-without-comment.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/scripts/ComentPlugin/mybatis-generator-without-template.xml b/src/test/resources/scripts/CommentPlugin/mybatis-generator-without-template.xml
similarity index 100%
rename from src/test/resources/scripts/ComentPlugin/mybatis-generator-without-template.xml
rename to src/test/resources/scripts/CommentPlugin/mybatis-generator-without-template.xml
diff --git a/src/test/resources/scripts/ComentPlugin/mybatis-generator.xml b/src/test/resources/scripts/CommentPlugin/mybatis-generator.xml
similarity index 98%
rename from src/test/resources/scripts/ComentPlugin/mybatis-generator.xml
rename to src/test/resources/scripts/CommentPlugin/mybatis-generator.xml
index ff8dc38..ebfd248 100644
--- a/src/test/resources/scripts/ComentPlugin/mybatis-generator.xml
+++ b/src/test/resources/scripts/CommentPlugin/mybatis-generator.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/src/test/resources/scripts/ComentPlugin/test-comment.ftl b/src/test/resources/scripts/CommentPlugin/test-comment.ftl
similarity index 100%
rename from src/test/resources/scripts/ComentPlugin/test-comment.ftl
rename to src/test/resources/scripts/CommentPlugin/test-comment.ftl