Browse Source

Make s-b-restclient test autoconfigs package-private

Fixes gh-48820
pull/48875/head
Andy Wilkinson 2 weeks ago
parent
commit
bd4c43bf53
  1. 4
      module/spring-boot-resttestclient/build.gradle
  2. 1
      module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/AutoConfigureRestTestClient.java
  3. 6
      module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/RestTestClientTestAutoConfiguration.java
  4. 6
      module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfiguration.java
  5. 2
      module/spring-boot-resttestclient/src/main/resources/META-INF/spring/org.springframework.boot.resttestclient.autoconfigure.AutoConfigureRestTestClient.imports
  6. 2
      module/spring-boot-resttestclient/src/main/resources/META-INF/spring/org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate.imports
  7. 8
      module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/autoconfigure/RestTestClientTestAutoConfigurationTests.java
  8. 8
      module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfigurationTests.java

4
module/spring-boot-resttestclient/build.gradle

@ -50,7 +50,7 @@ tasks.named("compileTestJava") { @@ -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"
]
}

1
module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/AutoConfigureRestTestClient.java

@ -31,7 +31,6 @@ import org.springframework.test.web.servlet.client.RestTestClient; @@ -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)

6
module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/RestTestClientAutoConfiguration.java → module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/RestTestClientTestAutoConfiguration.java

@ -33,16 +33,16 @@ import org.springframework.web.client.RestClient; @@ -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(

6
module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateAutoConfiguration.java → module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfiguration.java

@ -28,13 +28,13 @@ import org.springframework.context.ApplicationContext; @@ -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

2
module/spring-boot-resttestclient/src/main/resources/META-INF/spring/org.springframework.boot.resttestclient.autoconfigure.AutoConfigureRestTestClient.imports

@ -1 +1 @@ @@ -1 +1 @@
org.springframework.boot.resttestclient.autoconfigure.RestTestClientAutoConfiguration
org.springframework.boot.resttestclient.autoconfigure.RestTestClientTestAutoConfiguration

2
module/spring-boot-resttestclient/src/main/resources/META-INF/spring/org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate.imports

@ -1 +1 @@ @@ -1 +1 @@
org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateAutoConfiguration
org.springframework.boot.resttestclient.autoconfigure.TestRestTemplateTestAutoConfiguration

8
module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/autoconfigure/RestTestClientAutoConfigurationTests.java → module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/autoconfigure/RestTestClientTestAutoConfigurationTests.java

@ -43,15 +43,15 @@ import static org.mockito.Mockito.inOrder; @@ -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 { @@ -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) -> {

8
module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateAutoConfigurationTests.java → module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfigurationTests.java

@ -31,14 +31,14 @@ import org.springframework.boot.testsupport.classpath.resources.WithResource; @@ -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 { @@ -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) -> {
Loading…
Cancel
Save