@ -163,9 +163,9 @@ class TestRestTemplateTests {
@@ -163,9 +163,9 @@ class TestRestTemplateTests {
void httpComponentsAreBuiltConsideringSettingsInRestTemplateBuilder ( ) {
RestTemplateBuilder builder = new RestTemplateBuilder ( )
. requestFactoryBuilder ( ClientHttpRequestFactoryBuilder . httpComponents ( ) ) ;
assertThat ( getRedirectStrategy ( ( RestTemplateBuilder ) null ) ) . matches ( this : : isDont FollowStrategy ) ;
assertThat ( getRedirectStrategy ( ( RestTemplateBuilder ) null ) ) . matches ( this : : isFollowStrategy ) ;
assertThat ( getRedirectStrategy ( null , HttpClientOption . ENABLE_REDIRECTS ) ) . matches ( this : : isFollowStrategy ) ;
assertThat ( getRedirectStrategy ( builder ) ) . matches ( this : : isDont FollowStrategy ) ;
assertThat ( getRedirectStrategy ( builder ) ) . matches ( this : : isFollowStrategy ) ;
assertThat ( getRedirectStrategy ( builder , HttpClientOption . ENABLE_REDIRECTS ) ) . matches ( this : : isFollowStrategy ) ;
assertThat ( getRedirectStrategy ( builder . redirects ( Redirects . DONT_FOLLOW ) ) ) . matches ( this : : isDontFollowStrategy ) ;
assertThat ( getRedirectStrategy ( builder . redirects ( Redirects . DONT_FOLLOW ) , HttpClientOption . ENABLE_REDIRECTS ) )
@ -175,7 +175,7 @@ class TestRestTemplateTests {
@@ -175,7 +175,7 @@ class TestRestTemplateTests {
@Test
void withRequestFactorySettingsRedirectsForHttpComponents ( ) {
TestRestTemplate template = new TestRestTemplate ( ) ;
assertThat ( getRedirectStrategy ( template ) ) . matches ( this : : isDont FollowStrategy ) ;
assertThat ( getRedirectStrategy ( template ) ) . matches ( this : : isFollowStrategy ) ;
assertThat ( getRedirectStrategy ( template
. withRequestFactorySettings ( ClientHttpRequestFactorySettings . defaults ( ) . withRedirects ( Redirects . FOLLOW ) ) ) )
. matches ( this : : isFollowStrategy ) ;
@ -184,6 +184,15 @@ class TestRestTemplateTests {
@@ -184,6 +184,15 @@ class TestRestTemplateTests {
. matches ( this : : isDontFollowStrategy ) ;
}
@Test
void withRedirects ( ) {
TestRestTemplate template = new TestRestTemplate ( ) ;
assertThat ( getRedirectStrategy ( template ) ) . matches ( this : : isFollowStrategy ) ;
assertThat ( getRedirectStrategy ( template . withRedirects ( Redirects . FOLLOW ) ) ) . matches ( this : : isFollowStrategy ) ;
assertThat ( getRedirectStrategy ( template . withRedirects ( Redirects . DONT_FOLLOW ) ) )
. matches ( this : : isDontFollowStrategy ) ;
}
@Test
void withRequestFactorySettingsRedirectsForJdk ( ) {
TestRestTemplate template = new TestRestTemplate (