Make s-b-restclient test autoconfigs package-private

Fixes gh-48820
This commit is contained in:
Andy Wilkinson
2026-01-15 11:54:57 +00:00
parent bd96079565
commit bd4c43bf53
8 changed files with 18 additions and 19 deletions
@@ -50,7 +50,7 @@ tasks.named("compileTestJava") {
tasks.named("checkAutoConfigurationClasses") {
omittedFromImports = [
"org.springframework.boot.resttestclient.autoconfigure.RestTestClientAutoConfiguration",
"org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateAutoConfiguration"
"org.springframework.boot.resttestclient.autoconfigure.RestTestClientTestAutoConfiguration",
"org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateTestAutoConfiguration"
]
}
@@ -31,7 +31,6 @@ import org.springframework.test.web.servlet.client.RestTestClient;
*
* @author Stephane Nicoll
* @since 4.0.0
* @see RestTestClientAutoConfiguration
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@@ -33,16 +33,16 @@ import org.springframework.web.client.RestClient;
import org.springframework.web.context.WebApplicationContext;
/**
* Auto-configuration for {@link RestTestClient}.
* Test auto-configuration for {@link RestTestClient}.
*
* @author Stephane Nicoll
* @author Andy Wilkinson
* @author Phillip Webb
* @since 4.0.0
* @see AutoConfigureRestTestClient
*/
@AutoConfiguration
@ConditionalOnClass({ RestClient.class, RestTestClient.class, ClientHttpMessageConvertersCustomizer.class })
public final class RestTestClientAutoConfiguration {
final class RestTestClientTestAutoConfiguration {
@Bean
SpringBootRestTestClientBuilderCustomizer springBootRestTestClientBuilderCustomizer(
@@ -28,13 +28,13 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
/**
* Auto-configuration for {@link TestRestTemplate}.
* Test auto-configuration for {@link TestRestTemplate}.
*
* @author Andy Wilkinson
* @since 4.0.0
* @see AutoConfigureTestRestTemplate
*/
@AutoConfiguration
public final class TestRestTemplateAutoConfiguration {
final class TestRestTemplateTestAutoConfiguration {
@Bean(name = "org.springframework.boot.resttestclient.TestRestTemplate")
@ConditionalOnMissingBean
@@ -1 +1 @@
org.springframework.boot.resttestclient.autoconfigure.RestTestClientAutoConfiguration
org.springframework.boot.resttestclient.autoconfigure.RestTestClientTestAutoConfiguration
@@ -1 +1 @@
org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateAutoConfiguration
org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateTestAutoConfiguration
@@ -43,15 +43,15 @@ import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link RestTestClientAutoConfiguration}.
* Tests for {@link RestTestClientTestAutoConfiguration}.
*
* @author Andy Wilkinson
* @author Phillip Webb
*/
class RestTestClientAutoConfigurationTests {
class RestTestClientTestAutoConfigurationTests {
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(RestTestClientAutoConfiguration.class));
.withConfiguration(AutoConfigurations.of(RestTestClientTestAutoConfiguration.class));
@Test
void registersRestTestClient() {
@@ -78,7 +78,7 @@ class RestTestClientAutoConfigurationTests {
@WithResource(name = "META-INF/spring.factories",
content = """
org.springframework.boot.test.http.server.LocalTestWebServer$Provider=\
org.springframework.boot.resttestclient.autoconfigure.RestTestClientAutoConfigurationTests$TestLocalTestWebServerProvider
org.springframework.boot.resttestclient.autoconfigure.RestTestClientTestAutoConfigurationTests$TestLocalTestWebServerProvider
""")
void shouldDefineRestTestClientBoundToWebServer() {
this.contextRunner.run((context) -> {
@@ -31,14 +31,14 @@ import org.springframework.boot.testsupport.classpath.resources.WithResource;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link TestRestTemplateAutoConfiguration}.
* Tests for {@link TestRestTemplateTestAutoConfiguration}.
*
* @author Stephane Nicoll
*/
class TestRestTemplateAutoConfigurationTests {
class TestRestTemplateTestAutoConfigurationTests {
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(TestRestTemplateAutoConfiguration.class));
.withConfiguration(AutoConfigurations.of(TestRestTemplateTestAutoConfiguration.class));
@Test
void shouldFailTotRegisterTestRestTemplateWithoutWebServer() {
@@ -51,7 +51,7 @@ class TestRestTemplateAutoConfigurationTests {
@WithResource(name = "META-INF/spring.factories",
content = """
org.springframework.boot.test.http.server.LocalTestWebServer$Provider=\
org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateAutoConfigurationTests$TestLocalTestWebServerProvider
org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateTestAutoConfigurationTests$TestLocalTestWebServerProvider
""")
void shouldDefineTestRestTemplateBoundToWebServer() {
this.contextRunner.run((context) -> {