MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / pom

Method pom

src/test/java/org/htmlunit/ExternalTest.java:78–108  ·  view source on GitHub ↗

Tests that POM dependencies are the latest. @throws Exception if an error occurs

()

Source from the content-addressed store, hash-verified

76 * @throws Exception if an error occurs
77 */
78 @Test
79 public void pom() throws Exception {
80 final File pomFile = new File("pom.xml");
81 if (!pomFile.exists()) {
82 throw new IOException("POM file not found: " + pomFile.getAbsolutePath());
83 }
84
85 MavenXpp3Reader reader = new MavenXpp3Reader();
86 try (FileReader fileReader = new FileReader(pomFile)) {
87 final Model model = reader.read(fileReader);
88
89 final Pattern ignorePattern = Pattern.compile("" + model.getProperties().get("maven.version.ignore"));
90
91 final List<String> wrongVersions = new LinkedList<>();
92 for (var dep : model.getDependencies()) {
93 String version = dep.getVersion();
94 if (version.startsWith("${")) {
95 version = "" + model.getProperties().get(version.substring(2, version.length() - 1));
96 }
97 try {
98 assertVersion(dep.getGroupId(), dep.getArtifactId(), version, ignorePattern);
99 }
100 catch (final AssertionError e) {
101 wrongVersions.add(e.getMessage());
102 }
103 }
104 if (!wrongVersions.isEmpty()) {
105 Assertions.fail(String.join("\n ", wrongVersions));
106 }
107 }
108 }
109
110 /**
111 * Tests that we use the latest chrome driver.

Callers

nothing calls this directly

Calls 12

assertVersionMethod · 0.95
substringMethod · 0.80
getMessageMethod · 0.80
joinMethod · 0.80
compileMethod · 0.65
lengthMethod · 0.65
isEmptyMethod · 0.65
readMethod · 0.45
getMethod · 0.45
getVersionMethod · 0.45
startsWithMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected