use of org.springframework.boot.web.client.RestTemplateBuilder in project spring-boot by spring-projects.
the class CloudFoundrySecurityServiceTests method setup.
@Before
public void setup() throws Exception {
MockServerRestTemplateCustomizer mockServerCustomizer = new MockServerRestTemplateCustomizer();
RestTemplateBuilder builder = new RestTemplateBuilder(mockServerCustomizer);
this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, false);
this.server = mockServerCustomizer.getServer();
}
use of org.springframework.boot.web.client.RestTemplateBuilder in project spring-boot by spring-projects.
the class CloudFoundrySecurityServiceTests method skipSslValidationWhenTrue.
@Test
public void skipSslValidationWhenTrue() throws Exception {
RestTemplateBuilder builder = new RestTemplateBuilder();
this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, true);
RestTemplate restTemplate = (RestTemplate) ReflectionTestUtils.getField(this.securityService, "restTemplate");
assertThat(restTemplate.getRequestFactory()).isInstanceOf(SkipSslVerificationHttpRequestFactory.class);
}
use of org.springframework.boot.web.client.RestTemplateBuilder in project spring-boot by spring-projects.
the class CloudFoundrySecurityServiceTests method doNotskipSslValidationWhenFalse.
@Test
public void doNotskipSslValidationWhenFalse() throws Exception {
RestTemplateBuilder builder = new RestTemplateBuilder();
this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, false);
RestTemplate restTemplate = (RestTemplate) ReflectionTestUtils.getField(this.securityService, "restTemplate");
assertThat(restTemplate.getRequestFactory()).isNotInstanceOf(SkipSslVerificationHttpRequestFactory.class);
}
use of org.springframework.boot.web.client.RestTemplateBuilder in project spring-boot by spring-projects.
the class RootUriRequestExpectationManagerTests method bindToShouldReturnMockRestServiceServer.
@Test
public void bindToShouldReturnMockRestServiceServer() throws Exception {
RestTemplate restTemplate = new RestTemplateBuilder().build();
MockRestServiceServer bound = RootUriRequestExpectationManager.bindTo(restTemplate);
assertThat(bound).isNotNull();
}
use of org.springframework.boot.web.client.RestTemplateBuilder in project spring-boot by spring-projects.
the class TestRestTemplateTests method fromRestTemplateBuilder.
@Test
public void fromRestTemplateBuilder() {
RestTemplateBuilder builder = mock(RestTemplateBuilder.class);
RestTemplate delegate = new RestTemplate();
given(builder.build()).willReturn(delegate);
assertThat(new TestRestTemplate(builder).getRestTemplate()).isEqualTo(delegate);
}
Aggregations