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 ;
57
56
import org .springframework .http .RequestEntity .UriTemplateRequestEntity ;
58
57
import org .springframework .http .ResponseEntity ;
59
58
import org .springframework .http .client .ClientHttpRequestFactory ;
60
- import org .springframework .http .client .ClientHttpResponse ;
61
59
import org .springframework .http .client .HttpComponentsClientHttpRequestFactory ;
62
60
import org .springframework .util .Assert ;
63
- import org .springframework .web .client .DefaultResponseErrorHandler ;
61
+ import org .springframework .web .client .NoOpResponseErrorHandler ;
64
62
import org .springframework .web .client .RequestCallback ;
65
63
import org .springframework .web .client .ResponseExtractor ;
66
64
import org .springframework .web .client .RestTemplate ;
@@ -1077,12 +1075,4 @@ protected RequestConfig createRequestConfig() {
1077
1075
1078
1076
}
1079
1077
1080
- private static final class NoOpResponseErrorHandler extends DefaultResponseErrorHandler {
1081
-
1082
- @ Override
1083
- public void handleError (ClientHttpResponse response ) throws IOException {
1084
- }
1085
-
1086
- }
1087
-
1088
1078
}
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