Fix TestRestTemplate#patchFor methods visibility

Closes gh-7742
pull/7907/head
Stephane Nicoll 8 years ago
parent c3edf9e341
commit 062104f1d6

@ -575,10 +575,10 @@ public class TestRestTemplate {
* @param <T> the type of the return value
* @return the converted object
* @throws RestClientException on client-side HTTP error
* @since 1.4.4
* @see HttpEntity
* @since 1.4.3
*/
<T> T patchForObject(String url, Object request, Class<T> responseType,
public <T> T patchForObject(String url, Object request, Class<T> responseType,
Object... uriVariables) throws RestClientException {
return this.restTemplate.patchForObject(url, request, responseType, uriVariables);
}
@ -598,10 +598,10 @@ public class TestRestTemplate {
* @param <T> the type of the return value
* @return the converted object
* @throws RestClientException on client-side HTTP error
* @since 1.4.4
* @see HttpEntity
* @since 1.4.3
*/
<T> T patchForObject(String url, Object request, Class<T> responseType,
public <T> T patchForObject(String url, Object request, Class<T> responseType,
Map<String, ?> uriVariables) throws RestClientException {
return this.restTemplate.patchForObject(url, request, responseType, uriVariables);
}
@ -618,10 +618,10 @@ public class TestRestTemplate {
* @param <T> the type of the return value
* @return the converted object
* @throws RestClientException on client-side HTTP error
* @since 1.4.4
* @see HttpEntity
* @since 1.4.3
*/
<T> T patchForObject(URI url, Object request, Class<T> responseType)
public <T> T patchForObject(URI url, Object request, Class<T> responseType)
throws RestClientException {
return this.restTemplate.patchForObject(url, request, responseType);

@ -17,6 +17,7 @@
package org.springframework.boot.test.web.client;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URI;
import java.util.List;
@ -47,6 +48,7 @@ import static org.mockito.Mockito.mock;
*
* @author Dave Syer
* @author Phillip Webb
* @author Stephane Nicoll
*/
public class TestRestTemplateTests {
@ -93,6 +95,9 @@ public class TestRestTemplateTests {
throws IllegalArgumentException, IllegalAccessException {
Method equivalent = ReflectionUtils.findMethod(TestRestTemplate.class,
method.getName(), method.getParameterTypes());
assertThat(equivalent).as("Method %s not found", method).isNotNull();
assertThat(Modifier.isPublic(equivalent.getModifiers()))
.as("Method %s should have been public", equivalent).isTrue();
try {
equivalent.invoke(restTemplate,
mockArguments(method.getParameterTypes()));
@ -129,6 +134,12 @@ public class TestRestTemplateTests {
return mock(type);
}
}, new ReflectionUtils.MethodFilter() {
@Override
public boolean matches(Method method) {
return Modifier.isPublic(method.getModifiers());
}
});
}

Loading…
Cancel
Save