Merge branch '1.4.x' into 1.5.x

pull/8038/head
Andy Wilkinson 8 years ago
commit c31a2d8101

@ -131,6 +131,7 @@ public class TestRestTemplateTests {
return arguments; return arguments;
} }
@SuppressWarnings("rawtypes")
private Object mockArgument(Class<?> type) throws Exception { private Object mockArgument(Class<?> type) throws Exception {
if (String.class.equals(type)) { if (String.class.equals(type)) {
return "String"; return "String";
@ -148,8 +149,7 @@ public class TestRestTemplateTests {
return Object.class; return Object.class;
} }
if (RequestEntity.class.equals(type)) { if (RequestEntity.class.equals(type)) {
return new RequestEntity<>(HttpMethod.GET, return new RequestEntity(HttpMethod.GET, new URI("http://localhost"));
new URI("http://localhost"));
} }
return mock(type); return mock(type);
} }
@ -237,7 +237,8 @@ public class TestRestTemplateTests {
public void doWithTestRestTemplate(TestRestTemplate testRestTemplate, public void doWithTestRestTemplate(TestRestTemplate testRestTemplate,
URI relativeUri) { URI relativeUri) {
testRestTemplate.exchange( testRestTemplate.exchange(
new RequestEntity<>(HttpMethod.GET, relativeUri), String.class); new RequestEntity<String>(HttpMethod.GET, relativeUri),
String.class);
} }
}); });
@ -252,7 +253,7 @@ public class TestRestTemplateTests {
public void doWithTestRestTemplate(TestRestTemplate testRestTemplate, public void doWithTestRestTemplate(TestRestTemplate testRestTemplate,
URI relativeUri) { URI relativeUri) {
testRestTemplate.exchange( testRestTemplate.exchange(
new RequestEntity<>(HttpMethod.GET, relativeUri), new RequestEntity<String>(HttpMethod.GET, relativeUri),
new ParameterizedTypeReference<String>() { new ParameterizedTypeReference<String>() {
}); });
} }
@ -428,7 +429,8 @@ public class TestRestTemplateTests {
request.setResponse(new MockClientHttpResponse(new byte[0], HttpStatus.OK)); request.setResponse(new MockClientHttpResponse(new byte[0], HttpStatus.OK));
URI relativeUri = URI.create("a/b/c.txt"); URI relativeUri = URI.create("a/b/c.txt");
URI absoluteUri = URI.create("http://localhost:8080/" + relativeUri.toString()); URI absoluteUri = URI.create("http://localhost:8080/" + relativeUri.toString());
given(requestFactory.createRequest(eq(absoluteUri), any())).willReturn(request); given(requestFactory.createRequest(eq(absoluteUri), (HttpMethod) any()))
.willReturn(request);
RestTemplate delegate = new RestTemplate(); RestTemplate delegate = new RestTemplate();
TestRestTemplate template = new TestRestTemplate(delegate); TestRestTemplate template = new TestRestTemplate(delegate);
delegate.setRequestFactory(requestFactory); delegate.setRequestFactory(requestFactory);
@ -437,7 +439,7 @@ public class TestRestTemplateTests {
.willReturn(absoluteUri); .willReturn(absoluteUri);
template.setUriTemplateHandler(uriTemplateHandler); template.setUriTemplateHandler(uriTemplateHandler);
callback.doWithTestRestTemplate(template, relativeUri); callback.doWithTestRestTemplate(template, relativeUri);
verify(requestFactory).createRequest(eq(absoluteUri), any()); verify(requestFactory).createRequest(eq(absoluteUri), (HttpMethod) any());
} }
private void assertBasicAuthorizationInterceptorCredentials( private void assertBasicAuthorizationInterceptorCredentials(
@ -456,7 +458,7 @@ public class TestRestTemplateTests {
} }
private static interface TestRestTemplateCallback { private interface TestRestTemplateCallback {
void doWithTestRestTemplate(TestRestTemplate testRestTemplate, URI relativeUri); void doWithTestRestTemplate(TestRestTemplate testRestTemplate, URI relativeUri);

Loading…
Cancel
Save