From 80a1e1ae64dfe12767e360b63f49183a28035c93 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 19 Jan 2017 11:03:18 +0000 Subject: [PATCH] Polishing --- .../test/web/client/TestRestTemplateTests.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java index 8b519da9df..a0ca1c9955 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java @@ -131,6 +131,7 @@ public class TestRestTemplateTests { return arguments; } + @SuppressWarnings("rawtypes") private Object mockArgument(Class type) throws Exception { if (String.class.equals(type)) { return "String"; @@ -148,8 +149,7 @@ public class TestRestTemplateTests { return Object.class; } if (RequestEntity.class.equals(type)) { - return new RequestEntity<>(HttpMethod.GET, - new URI("http://localhost")); + return new RequestEntity(HttpMethod.GET, new URI("http://localhost")); } return mock(type); } @@ -237,7 +237,8 @@ public class TestRestTemplateTests { public void doWithTestRestTemplate(TestRestTemplate testRestTemplate, URI relativeUri) { testRestTemplate.exchange( - new RequestEntity<>(HttpMethod.GET, relativeUri), String.class); + new RequestEntity(HttpMethod.GET, relativeUri), + String.class); } }); @@ -252,7 +253,7 @@ public class TestRestTemplateTests { public void doWithTestRestTemplate(TestRestTemplate testRestTemplate, URI relativeUri) { testRestTemplate.exchange( - new RequestEntity<>(HttpMethod.GET, relativeUri), + new RequestEntity(HttpMethod.GET, relativeUri), new ParameterizedTypeReference() { }); } @@ -428,7 +429,8 @@ public class TestRestTemplateTests { request.setResponse(new MockClientHttpResponse(new byte[0], HttpStatus.OK)); URI relativeUri = URI.create("a/b/c.txt"); 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(); TestRestTemplate template = new TestRestTemplate(delegate); delegate.setRequestFactory(requestFactory); @@ -437,7 +439,7 @@ public class TestRestTemplateTests { .willReturn(absoluteUri); template.setUriTemplateHandler(uriTemplateHandler); callback.doWithTestRestTemplate(template, relativeUri); - verify(requestFactory).createRequest(eq(absoluteUri), any()); + verify(requestFactory).createRequest(eq(absoluteUri), (HttpMethod) any()); } private void assertBasicAuthorizationInterceptorCredentials( @@ -456,7 +458,7 @@ public class TestRestTemplateTests { } - private static interface TestRestTemplateCallback { + private interface TestRestTemplateCallback { void doWithTestRestTemplate(TestRestTemplate testRestTemplate, URI relativeUri);