Skip to content

Commit 1530ada

Browse files
committed
Upgrade maven failsafe and surefire plugins to versions that are compatible with JUnit 5. Fixes #279
1 parent b9409dc commit 1530ada

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

src/main/resources/META-INF/rewrite/junit5.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ recipeList:
105105
artifactId: junit-jupiter-params
106106
version: 5.x
107107
onlyIfUsing: org.junit.jupiter.params.ParameterizedTest
108+
- org.openrewrite.maven.UpgradePluginVersion:
109+
groupId: org.apache.maven.plugins
110+
artifactId: maven-surefire-plugin
111+
newVersion: 2.22.x
112+
- org.openrewrite.maven.UpgradePluginVersion:
113+
groupId: org.apache.maven.plugins
114+
artifactId: maven-failsafe-plugin
115+
newVersion: 2.22.x
108116

109117
---
110118
type: specs.openrewrite.org/v1beta/recipe

src/test/java/org/openrewrite/java/testing/junit5/JUnit5MigrationTest.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.openrewrite.test.RewriteTest;
2424

2525
import static org.openrewrite.java.Assertions.java;
26+
import static org.openrewrite.maven.Assertions.pomXml;
2627

2728
class JUnit5MigrationTest implements RewriteTest {
2829

@@ -77,4 +78,59 @@ void filterShouldRemoveUnusedConfig() {
7778
)
7879
);
7980
}
81+
82+
@Test
83+
@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/279")
84+
void upgradeMavenPluginVersions() {
85+
rewriteRun(
86+
pomXml(
87+
"""
88+
<project>
89+
<modelVersion>4.0.0</modelVersion>
90+
<groupId>com.example.jackson</groupId>
91+
<artifactId>test-plugins</artifactId>
92+
<version>1.0.0</version>
93+
<build>
94+
<plugins>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-surefire-plugin</artifactId>
98+
<version>2.20.1</version>
99+
</plugin>
100+
<plugin>
101+
<groupId>org.apache.maven.plugins</groupId>
102+
<artifactId>maven-failsafe-plugin</artifactId>
103+
<version>2.20.1</version>
104+
</plugin>
105+
</plugins>
106+
</build>
107+
</project>
108+
""",
109+
"""
110+
<project>
111+
<modelVersion>4.0.0</modelVersion>
112+
<groupId>com.example.jackson</groupId>
113+
<artifactId>test-plugins</artifactId>
114+
<version>1.0.0</version>
115+
<build>
116+
<plugins>
117+
<plugin>
118+
<groupId>org.apache.maven.plugins</groupId>
119+
<artifactId>maven-surefire-plugin</artifactId>
120+
<version>2.22.2</version>
121+
</plugin>
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-failsafe-plugin</artifactId>
125+
<version>2.22.2</version>
126+
</plugin>
127+
</plugins>
128+
</build>
129+
</project>
130+
"""
131+
)
132+
);
133+
}
134+
135+
80136
}

0 commit comments

Comments
 (0)