Skip to content

Commit 2183b47

Browse files
committed
Merge branch '3.1.x' into 3.2.x
Closes gh-40612
2 parents c7ec608 + 447ffb5 commit 2183b47

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,6 @@
3838
import org.springframework.http.client.ClientHttpRequest;
3939
import org.springframework.http.client.ClientHttpRequestFactory;
4040
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
41-
import org.springframework.http.client.JettyClientHttpRequestFactory;
4241
import org.springframework.http.client.SimpleClientHttpRequestFactory;
4342
import org.springframework.mock.env.MockEnvironment;
4443
import org.springframework.mock.http.client.MockClientHttpRequest;
@@ -86,16 +85,15 @@ void simple() {
8685

8786
@Test
8887
void doNotReplaceCustomRequestFactory() {
89-
RestTemplateBuilder builder = new RestTemplateBuilder()
90-
.requestFactory(HttpComponentsClientHttpRequestFactory.class);
88+
RestTemplateBuilder builder = new RestTemplateBuilder().requestFactory(TestClientHttpRequestFactory.class);
9189
TestRestTemplate testRestTemplate = new TestRestTemplate(builder);
9290
assertThat(testRestTemplate.getRestTemplate().getRequestFactory())
93-
.isInstanceOf(HttpComponentsClientHttpRequestFactory.class);
91+
.isInstanceOf(TestClientHttpRequestFactory.class);
9492
}
9593

9694
@Test
9795
void useTheSameRequestFactoryClassWithBasicAuth() {
98-
JettyClientHttpRequestFactory customFactory = new JettyClientHttpRequestFactory();
96+
TestClientHttpRequestFactory customFactory = new TestClientHttpRequestFactory();
9997
RestTemplateBuilder builder = new RestTemplateBuilder().requestFactory(() -> customFactory);
10098
TestRestTemplate testRestTemplate = new TestRestTemplate(builder).withBasicAuth("test", "test");
10199
RestTemplate restTemplate = testRestTemplate.getRestTemplate();
@@ -387,4 +385,8 @@ interface TestRestTemplateCallback {
387385

388386
}
389387

388+
static class TestClientHttpRequestFactory extends SimpleClientHttpRequestFactory {
389+
390+
}
391+
390392
}

0 commit comments

Comments
 (0)