Skip to content

Commit

Permalink
Fixing expectations on AddParentPomTest
Browse files Browse the repository at this point in the history
  • Loading branch information
rcsilva83 committed Jun 27, 2024
1 parent c1cce07 commit fb121e8
Showing 1 changed file with 7 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,77 +298,22 @@ void multiModuleRelativePathChangeChildrens() {
);
}

@Test
void addParentWithVersionPattern() {
rewriteRun(
spec -> spec.recipe(new AddParentPom(
"org.springframework.boot",
"spring-boot-starter-parent",
null,
null,
"~1.5",
null
)),
pomXml(
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.12.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
</project>
""",
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.22.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
</project>
"""
)
);
}

@Test
void wildcardVersion() {
rewriteRun(
spec -> spec.recipe(new AddParentPom(
"org.springframework.boot",
"spring-boot-starter-parent",
"~1.5",
null,
null,
"~1.5",
null
)),
pomXml(
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.12.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
Expand All @@ -377,12 +322,10 @@ void wildcardVersion() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.22.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mycompany.app</groupId>
Expand Down Expand Up @@ -589,8 +532,10 @@ void shouldNotAddToDependencyManagement() {
pomXml(
"""
<project>
<artifactId>example</artifactId>
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0.0</version>
<properties>
<jenkins.version>2.387.3</jenkins.version>
</properties>
Expand Down Expand Up @@ -627,14 +572,16 @@ void shouldNotAddToDependencyManagement() {
""",
"""
<project>
<artifactId>example</artifactId>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.81</version>
<relativePath/>
</parent>
<groupId>org.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0.0</version>
<properties>
<jenkins.version>2.387.3</jenkins.version>
</properties>
Expand Down

0 comments on commit fb121e8

Please sign in to comment.