Skip to content

Commit

Permalink
Merge pull request #47 from gounthar/add-test
Browse files Browse the repository at this point in the history
Add test
  • Loading branch information
gounthar authored Oct 18, 2024
2 parents f161459 + a5262eb commit bb4b081
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,28 @@ public void testUpdateJenkinsMinimalVersion() throws Exception {
logger.info("Jenkins version found: " + jenkinsVersion);
assertEquals("2.462.2", jenkinsVersion);
}

/**
* Tests the replaceHttpWithHttps method of PomModifier.
*
* @throws Exception if an error occurs during the test
*/
@Test
public void testReplaceHttpWithHttps() throws Exception {
PomModifier pomModifier = new PomModifier(OUTPUT_POM_PATH);
pomModifier.replaceHttpWithHttps();
pomModifier.savePom(OUTPUT_POM_PATH);

DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(new File(OUTPUT_POM_PATH));
doc.getDocumentElement().normalize();

NodeList repositoryUrls = doc.getElementsByTagName("url");
for (int i = 0; i < repositoryUrls.getLength(); i++) {
Node urlNode = repositoryUrls.item(i);
String url = urlNode.getTextContent();
assertTrue(url.startsWith("https://"), "URL should start with https://");
}
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.124</version>
<version>1.125</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -61,7 +61,7 @@
<jgit.version>7.0.0.202409031743-r</jgit.version>
<github-api.version>1.326</github-api.version>
<commons-compress.version>1.27.1</commons-compress.version>
<byte-buddy.version>1.15.4</byte-buddy.version>
<byte-buddy.version>1.15.5</byte-buddy.version>
<wiremock.version>3.9.1</wiremock.version>
<jte.version>3.1.13</jte.version>
<snakeyaml.version>2.3</snakeyaml.version>
Expand Down

0 comments on commit bb4b081

Please sign in to comment.