File tree 2 files changed +4
-14
lines changed
spring-boot-project/spring-boot-test/src
main/java/org/springframework/boot/test/web/client
test/java/org/springframework/boot/test/web/client
2 files changed +4
-14
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .boot .test .web .client ;
18
18
19
- import java .io .IOException ;
20
19
import java .net .URI ;
21
20
import java .security .KeyManagementException ;
22
21
import java .security .KeyStoreException ;
58
57
import org .springframework .http .RequestEntity .UriTemplateRequestEntity ;
59
58
import org .springframework .http .ResponseEntity ;
60
59
import org .springframework .http .client .ClientHttpRequestFactory ;
61
- import org .springframework .http .client .ClientHttpResponse ;
62
60
import org .springframework .http .client .HttpComponentsClientHttpRequestFactory ;
63
61
import org .springframework .util .Assert ;
64
- import org .springframework .web .client .DefaultResponseErrorHandler ;
62
+ import org .springframework .web .client .NoOpResponseErrorHandler ;
65
63
import org .springframework .web .client .RequestCallback ;
66
64
import org .springframework .web .client .ResponseExtractor ;
67
65
import org .springframework .web .client .RestTemplate ;
@@ -1078,14 +1076,6 @@ protected RequestConfig createRequestConfig() {
1078
1076
1079
1077
}
1080
1078
1081
- private static final class NoOpResponseErrorHandler extends DefaultResponseErrorHandler {
1082
-
1083
- @ Override
1084
- public void handleError (ClientHttpResponse response ) throws IOException {
1085
- }
1086
-
1087
- }
1088
-
1089
1079
private static final class TrustSelfSignedStrategy implements TrustStrategy {
1090
1080
1091
1081
@ Override
Original file line number Diff line number Diff line change 45
45
import org .springframework .test .util .ReflectionTestUtils ;
46
46
import org .springframework .util .ReflectionUtils ;
47
47
import org .springframework .util .ReflectionUtils .MethodCallback ;
48
+ import org .springframework .web .client .NoOpResponseErrorHandler ;
48
49
import org .springframework .web .client .ResponseErrorHandler ;
49
50
import org .springframework .web .client .RestOperations ;
50
51
import org .springframework .web .client .RestTemplate ;
@@ -223,13 +224,12 @@ private Stream<Class<?>> getConverterClasses(TestRestTemplate testRestTemplate)
223
224
}
224
225
225
226
@ Test
226
- void withBasicAuthShouldUseNoOpErrorHandler () throws Exception {
227
+ void withBasicAuthShouldUseNoOpErrorHandler () {
227
228
TestRestTemplate originalTemplate = new TestRestTemplate ("foo" , "bar" );
228
229
ResponseErrorHandler errorHandler = mock (ResponseErrorHandler .class );
229
230
originalTemplate .getRestTemplate ().setErrorHandler (errorHandler );
230
231
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 );
233
233
}
234
234
235
235
@ Test
You can’t perform that action at this time.
0 commit comments