增加版本号检查.

This commit is contained in:
nieqiurong 2023-12-04 22:45:04 +08:00
parent beed4977c7
commit 473d40e8b6
2 changed files with 10 additions and 2 deletions

View File

@ -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");
} }
} }

View File

@ -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");
} }
} }