Skip to content

Commit e144392

Browse files
committed
Add: recipes to handle the new spring-boot-webtestclient module
1 parent 3506511 commit e144392

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

src/main/resources/META-INF/rewrite/spring-boot-40-modular-starters.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,19 @@ recipeList:
271271
oldPackageName: org.springframework.boot.test.autoconfigure.web.servlet
272272
newPackageName: org.springframework.boot.webmvc.test.autoconfigure
273273
recursive: true
274+
# spring-boot-webtestclient (originating from spring-boot-test-autoconfigure and spring-boot-test)
275+
- org.openrewrite.java.ChangeType:
276+
oldFullyQualifiedTypeName: org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
277+
newFullyQualifiedTypeName: org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient
278+
- org.openrewrite.java.ChangeType:
279+
oldFullyQualifiedTypeName: org.springframework.boot.test.autoconfigure.web.reactive.WebTestClientAutoConfiguration
280+
newFullyQualifiedTypeName: org.springframework.boot.webtestclient.autoconfigure.WebTestClientAutoConfiguration
281+
- org.openrewrite.java.ChangeType:
282+
oldFullyQualifiedTypeName: org.springframework.boot.test.autoconfigure.web.reactive.SpringBootWebTestClientBuilderCustomizer
283+
newFullyQualifiedTypeName: org.springframework.boot.webtestclient.autoconfigure.SpringBootWebTestClientBuilderCustomizer
284+
- org.openrewrite.java.ChangeType:
285+
oldFullyQualifiedTypeName: org.springframework.boot.test.web.reactive.server.WebTestClientBuilderCustomizer
286+
newFullyQualifiedTypeName: org.springframework.boot.webtestclient.autoconfigure.WebTestClientBuilderCustomizer
274287
# spring-boot-webservices
275288
- org.openrewrite.java.ChangePackage:
276289
oldPackageName: org.springframework.boot.autoconfigure.webservices

src/test/java/org/openrewrite/java/spring/boot4/MigrateToModularStartersTest.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,46 @@ class A {
346346
)
347347
);
348348
}
349+
350+
@Nested
351+
class MigrateAutoconfigurePackages {
352+
353+
@Test
354+
void migrateSpringBootWebtestclient() {
355+
rewriteRun(
356+
//language=java
357+
java(
358+
"""
359+
import java.util.Collections;
360+
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
361+
import org.springframework.boot.test.autoconfigure.web.reactive.WebTestClientAutoConfiguration;
362+
import org.springframework.boot.test.autoconfigure.web.reactive.SpringBootWebTestClientBuilderCustomizer;
363+
import org.springframework.boot.test.web.reactive.server.WebTestClientBuilderCustomizer;
364+
365+
@AutoConfigureWebTestClient
366+
class WebClientTest {
367+
private final WebTestClientAutoConfiguration webTestClientAutoConfiguration = new WebTestClientAutoConfiguration();
368+
private final SpringBootWebTestClientBuilderCustomizer springBootWebTestClientBuilderCustomizer = new SpringBootWebTestClientBuilderCustomizer(Collections.emptyList());
369+
private final WebTestClientBuilderCustomizer webTestClientBuilderCustomizer = builder -> {};
370+
}
371+
"""
372+
,
373+
"""
374+
import java.util.Collections;
375+
import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient;
376+
import org.springframework.boot.webtestclient.autoconfigure.WebTestClientAutoConfiguration;
377+
import org.springframework.boot.webtestclient.autoconfigure.SpringBootWebTestClientBuilderCustomizer;
378+
import org.springframework.boot.webtestclient.autoconfigure.WebTestClientBuilderCustomizer;
379+
380+
@AutoConfigureWebTestClient
381+
class WebClientTest {
382+
private final WebTestClientAutoConfiguration webTestClientAutoConfiguration = new WebTestClientAutoConfiguration();
383+
private final SpringBootWebTestClientBuilderCustomizer springBootWebTestClientBuilderCustomizer = new SpringBootWebTestClientBuilderCustomizer(Collections.emptyList());
384+
private final WebTestClientBuilderCustomizer webTestClientBuilderCustomizer = builder -> {};
385+
}
386+
"""
387+
)
388+
);
389+
}
390+
}
349391
}

0 commit comments

Comments
 (0)