|
|
|
@ -414,8 +414,8 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
.getRequestFactory();
|
|
|
|
|
assertThat(actualRequestFactory)
|
|
|
|
|
.isInstanceOf(InterceptingClientHttpRequestFactory.class);
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(actualRequestFactory,
|
|
|
|
|
"requestFactory")).isSameAs(requestFactory);
|
|
|
|
|
assertThat(actualRequestFactory).hasFieldOrPropertyWithValue(
|
|
|
|
|
"requestFactory", requestFactory);
|
|
|
|
|
}).build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -444,8 +444,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
ClientHttpRequestFactory requestFactory = this.builder
|
|
|
|
|
.requestFactory(SimpleClientHttpRequestFactory.class)
|
|
|
|
|
.setConnectTimeout(null).build().getRequestFactory();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "connectTimeout"))
|
|
|
|
|
.isEqualTo(-1);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -453,8 +452,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
ClientHttpRequestFactory requestFactory = this.builder
|
|
|
|
|
.requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(null)
|
|
|
|
|
.build().getRequestFactory();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "readTimeout"))
|
|
|
|
|
.isEqualTo(-1);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -480,8 +478,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
ClientHttpRequestFactory requestFactory = this.builder
|
|
|
|
|
.requestFactory(SimpleClientHttpRequestFactory.class)
|
|
|
|
|
.setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "connectTimeout"))
|
|
|
|
|
.isEqualTo(1234);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -489,8 +486,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
ClientHttpRequestFactory requestFactory = this.builder
|
|
|
|
|
.requestFactory(SimpleClientHttpRequestFactory.class)
|
|
|
|
|
.setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "readTimeout"))
|
|
|
|
|
.isEqualTo(1234);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -520,8 +516,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
.requestFactory(
|
|
|
|
|
() -> new BufferingClientHttpRequestFactory(requestFactory))
|
|
|
|
|
.setConnectTimeout(Duration.ofMillis(1234)).build();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "connectTimeout"))
|
|
|
|
|
.isEqualTo(1234);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -531,8 +526,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
.requestFactory(
|
|
|
|
|
() -> new BufferingClientHttpRequestFactory(requestFactory))
|
|
|
|
|
.setReadTimeout(Duration.ofMillis(1234)).build();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "readTimeout"))
|
|
|
|
|
.isEqualTo(1234);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -552,8 +546,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
ClientHttpRequestFactory requestFactory = this.builder
|
|
|
|
|
.requestFactory(SimpleClientHttpRequestFactory.class)
|
|
|
|
|
.setConnectTimeout(1234).build().getRequestFactory();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "connectTimeout"))
|
|
|
|
|
.isEqualTo(1234);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -562,8 +555,7 @@ public class RestTemplateBuilderTests {
|
|
|
|
|
ClientHttpRequestFactory requestFactory = this.builder
|
|
|
|
|
.requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(1234)
|
|
|
|
|
.build().getRequestFactory();
|
|
|
|
|
assertThat(ReflectionTestUtils.getField(requestFactory, "readTimeout"))
|
|
|
|
|
.isEqualTo(1234);
|
|
|
|
|
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class RestTemplateSubclass extends RestTemplate {
|
|
|
|
|