2323import org .openrewrite .test .RecipeSpec ;
2424import org .openrewrite .test .RewriteTest ;
2525
26+ import java .util .List ;
27+ import java .util .regex .MatchResult ;
28+ import java .util .regex .Pattern ;
29+
30+ import static org .assertj .core .api .Assertions .assertThat ;
2631import static org .openrewrite .java .Assertions .java ;
2732import static org .openrewrite .maven .Assertions .pomXml ;
2833
@@ -112,8 +117,8 @@ public void filterShouldRemoveUnusedConfig() {
112117 @ Issue ("https://github.com/openrewrite/rewrite-testing-frameworks/issues/279" )
113118 void upgradeMavenPluginVersions () {
114119 rewriteRun (
115- //language=xml
116120 pomXml (
121+ //language=xml
117122 """
118123 <project>
119124 <modelVersion>4.0.0</modelVersion>
@@ -136,28 +141,15 @@ void upgradeMavenPluginVersions() {
136141 </build>
137142 </project>
138143 """ ,
139- """
140- <project>
141- <modelVersion>4.0.0</modelVersion>
142- <groupId>com.example.jackson</groupId>
143- <artifactId>test-plugins</artifactId>
144- <version>1.0.0</version>
145- <build>
146- <plugins>
147- <plugin>
148- <groupId>org.apache.maven.plugins</groupId>
149- <artifactId>maven-surefire-plugin</artifactId>
150- <version>2.22.2</version>
151- </plugin>
152- <plugin>
153- <groupId>org.apache.maven.plugins</groupId>
154- <artifactId>maven-failsafe-plugin</artifactId>
155- <version>2.22.2</version>
156- </plugin>
157- </plugins>
158- </build>
159- </project>
160- """
144+ spec -> spec .after (actual -> {
145+ List <MatchResult > list = Pattern .compile ("<version>(.*)</version>" )
146+ .matcher (actual ).results ().skip (1 ).toList ();
147+ assertThat (list )
148+ .hasSize (2 )
149+ .extracting (mr -> mr .group (1 ))
150+ .allMatch (m -> m .startsWith ("3." ));
151+ return actual ;
152+ })
161153 )
162154 );
163155 }
0 commit comments