Skip to content

Commit

Permalink
Demonstrate removal of explicit junit4 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Sep 19, 2024
1 parent 5be8a6f commit 235f3d4
Showing 1 changed file with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,67 @@ void bumpSurefireOnOlderMavenVersions() {
)
);
}

@Test
void removeAndExcludeJUnit4Dependency() {
rewriteRun(
//language=xml
pomXml(
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.example</groupId>
<artifactId>project</artifactId>
<version>0.0.1</version>
<properties>
<my-junit.version>4.13.2</my-junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${my-junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
""",
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.example</groupId>
<artifactId>project</artifactId>
<version>0.0.1</version>
<properties>
<my-junit.version>4.13.2</my-junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
"""
)
);
}
}

0 comments on commit 235f3d4

Please sign in to comment.