浏览代码

增加版本号检查.

nieqiurong 1 年之前
父节点
当前提交
473d40e8b6

+ 5 - 1
spring-boot-starter/mybatis-plus-boot-starter/src/test/java/com/baomidou/mybatisplus/test/pom/GeneratePomTest.java

@@ -42,6 +42,7 @@ class GeneratePomTest {
     private static class Dependency {
     private static class Dependency {
         private String artifactId;
         private String artifactId;
         private String scope;
         private String scope;
+        private String version;
         private boolean optional;
         private boolean optional;
     }
     }
 
 
@@ -54,7 +55,7 @@ class GeneratePomTest {
             Map<String, Dependency> dependenciesMap = new HashMap<>();
             Map<String, Dependency> dependenciesMap = new HashMap<>();
             dependencies.forEach($this -> {
             dependencies.forEach($this -> {
                 String artifactId = $this.s("artifactId").text();
                 String artifactId = $this.s("artifactId").text();
-                dependenciesMap.put(artifactId, new Dependency(artifactId, $this.s("scope").text(), Boolean.parseBoolean($this.s("optional").text())));
+                dependenciesMap.put(artifactId, new Dependency(artifactId, $this.s("scope").text(), $this.s("version").text(), Boolean.parseBoolean($this.s("optional").text())));
             });
             });
             Dependency mp = dependenciesMap.get("mybatis-plus");
             Dependency mp = dependenciesMap.get("mybatis-plus");
             Assertions.assertEquals("compile", mp.getScope());
             Assertions.assertEquals("compile", mp.getScope());
@@ -74,6 +75,9 @@ class GeneratePomTest {
             Dependency bom = dependenciesMap.get("spring-boot-dependencies");
             Dependency bom = dependenciesMap.get("spring-boot-dependencies");
             Assertions.assertEquals("import", bom.getScope());
             Assertions.assertEquals("import", bom.getScope());
             Assertions.assertFalse(bom.isOptional());
             Assertions.assertFalse(bom.isOptional());
+            Assertions.assertEquals(dependenciesMap.get("spring-cloud-commons").getVersion(), "3.1.1");
+            Assertions.assertEquals(dependenciesMap.get("mybatis-spring").getVersion(), "2.1.2");
+            Assertions.assertEquals(dependenciesMap.get("spring-boot-dependencies").getVersion(), "2.7.15");
         }
         }
     }
     }
 
 

+ 5 - 1
spring-boot-starter/mybatis-plus-spring-boot3-starter/src/test/java/com/baomidou/mybatisplus/test/pom/GeneratePomTest.java

@@ -42,6 +42,7 @@ class GeneratePomTest {
     private static class Dependency {
     private static class Dependency {
         private String artifactId;
         private String artifactId;
         private String scope;
         private String scope;
+        private String version;
         private boolean optional;
         private boolean optional;
     }
     }
 
 
@@ -54,7 +55,7 @@ class GeneratePomTest {
             Map<String, Dependency> dependenciesMap = new HashMap<>();
             Map<String, Dependency> dependenciesMap = new HashMap<>();
             dependencies.forEach($this -> {
             dependencies.forEach($this -> {
                 String artifactId = $this.s("artifactId").text();
                 String artifactId = $this.s("artifactId").text();
-                dependenciesMap.put(artifactId, new Dependency(artifactId, $this.s("scope").text(), Boolean.parseBoolean($this.s("optional").text())));
+                dependenciesMap.put(artifactId, new Dependency(artifactId, $this.s("scope").text(), $this.s("version").text(), Boolean.parseBoolean($this.s("optional").text())));
             });
             });
             Dependency mp = dependenciesMap.get("mybatis-plus");
             Dependency mp = dependenciesMap.get("mybatis-plus");
             Assertions.assertEquals("compile", mp.getScope());
             Assertions.assertEquals("compile", mp.getScope());
@@ -74,6 +75,9 @@ class GeneratePomTest {
             Dependency bom = dependenciesMap.get("spring-boot-dependencies");
             Dependency bom = dependenciesMap.get("spring-boot-dependencies");
             Assertions.assertEquals("import", bom.getScope());
             Assertions.assertEquals("import", bom.getScope());
             Assertions.assertFalse(bom.isOptional());
             Assertions.assertFalse(bom.isOptional());
+            Assertions.assertEquals(dependenciesMap.get("spring-cloud-commons").getVersion(), "4.0.4");
+            Assertions.assertEquals(dependenciesMap.get("mybatis-spring").getVersion(), "3.0.3");
+            Assertions.assertEquals(dependenciesMap.get("spring-boot-dependencies").getVersion(), "3.2.0");
         }
         }
     }
     }