Skip to content

Commit 6110e0f

Browse files
committed
Merge branch '3.2.x'
Closes spring-projectsgh-41184
2 parents 908f091 + e9eeac9 commit 6110e0f

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

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

+1-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.test.web.client;
1818

19-
import java.io.IOException;
2019
import java.net.URI;
2120
import java.security.KeyManagementException;
2221
import java.security.KeyStoreException;
@@ -58,10 +57,9 @@
5857
import org.springframework.http.RequestEntity.UriTemplateRequestEntity;
5958
import org.springframework.http.ResponseEntity;
6059
import org.springframework.http.client.ClientHttpRequestFactory;
61-
import org.springframework.http.client.ClientHttpResponse;
6260
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
6361
import org.springframework.util.Assert;
64-
import org.springframework.web.client.DefaultResponseErrorHandler;
62+
import org.springframework.web.client.NoOpResponseErrorHandler;
6563
import org.springframework.web.client.RequestCallback;
6664
import org.springframework.web.client.ResponseExtractor;
6765
import org.springframework.web.client.RestTemplate;
@@ -1078,14 +1076,6 @@ protected RequestConfig createRequestConfig() {
10781076

10791077
}
10801078

1081-
private static final class NoOpResponseErrorHandler extends DefaultResponseErrorHandler {
1082-
1083-
@Override
1084-
public void handleError(ClientHttpResponse response) throws IOException {
1085-
}
1086-
1087-
}
1088-
10891079
private static final class TrustSelfSignedStrategy implements TrustStrategy {
10901080

10911081
@Override

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.springframework.test.util.ReflectionTestUtils;
4646
import org.springframework.util.ReflectionUtils;
4747
import org.springframework.util.ReflectionUtils.MethodCallback;
48+
import org.springframework.web.client.NoOpResponseErrorHandler;
4849
import org.springframework.web.client.ResponseErrorHandler;
4950
import org.springframework.web.client.RestOperations;
5051
import org.springframework.web.client.RestTemplate;
@@ -223,13 +224,12 @@ private Stream<Class<?>> getConverterClasses(TestRestTemplate testRestTemplate)
223224
}
224225

225226
@Test
226-
void withBasicAuthShouldUseNoOpErrorHandler() throws Exception {
227+
void withBasicAuthShouldUseNoOpErrorHandler() {
227228
TestRestTemplate originalTemplate = new TestRestTemplate("foo", "bar");
228229
ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class);
229230
originalTemplate.getRestTemplate().setErrorHandler(errorHandler);
230231
TestRestTemplate basicAuthTemplate = originalTemplate.withBasicAuth("user", "password");
231-
assertThat(basicAuthTemplate.getRestTemplate().getErrorHandler()).isInstanceOf(
232-
Class.forName("org.springframework.boot.test.web.client.TestRestTemplate$NoOpResponseErrorHandler"));
232+
assertThat(basicAuthTemplate.getRestTemplate().getErrorHandler()).isInstanceOf(NoOpResponseErrorHandler.class);
233233
}
234234

235235
@Test

0 commit comments

Comments
 (0)