mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish "Remove @ConditionalOnMissingBean from RestTemplateBuilderConfigurer"
See gh-37746
This commit is contained in:
parent
882e29dc7f
commit
6874a2fb9a
@ -43,7 +43,6 @@ import org.springframework.mock.http.client.MockClientHttpResponse;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
import static org.mockito.BDDMockito.then;
|
import static org.mockito.BDDMockito.then;
|
||||||
@ -68,12 +67,11 @@ class RestTemplateAutoConfigurationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void assertExceptionWhenCustomRestTemplateConfigurerIsDefined() {
|
void shouldFailOnCustomRestTemplateBuilderConfigurer() {
|
||||||
this.contextRunner
|
this.contextRunner.withUserConfiguration(RestTemplateCustomConfigurerConfig.class)
|
||||||
.withUserConfiguration(RestTemplateCustomConfigurerConfig.class)
|
.run((context) -> assertThat(context).getFailure()
|
||||||
.run((context) -> assertThrows( BeanDefinitionOverrideException.class, () ->{
|
.isInstanceOf(BeanDefinitionOverrideException.class)
|
||||||
context.getBeanFactory().getBeanDefinition("restTemplateBuilderConfigurer");
|
.hasMessageContaining("with name 'restTemplateBuilderConfigurer'"));
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user