@ -24,6 +24,7 @@ import org.junit.Test;
import org.springframework.boot.test.web.client.TestRestTemplate.CustomHttpComponentsClientHttpRequestFactory ;
import org.springframework.boot.test.web.client.TestRestTemplate.HttpClientOption ;
import org.springframework.boot.web.client.RestTemplateBuilder ;
import org.springframework.http.HttpMethod ;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory ;
import org.springframework.http.client.InterceptingClientHttpRequestFactory ;
@ -33,6 +34,7 @@ import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate ;
import static org.assertj.core.api.Assertions.assertThat ;
import static org.mockito.BDDMockito.given ;
import static org.mockito.Mockito.mock ;
/ * *
@ -43,6 +45,14 @@ import static org.mockito.Mockito.mock;
* /
public class TestRestTemplateTests {
@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 ) ;
}
@Test
public void simple ( ) {
// The Apache client is on the classpath so we get the fully-fledged factory