Polish
This commit is contained in:
parent
81dfadcb16
commit
3d61f7ba60
|
|
@ -45,8 +45,18 @@ import org.springframework.http.converter.HttpMessageConverter;
|
|||
import org.springframework.util.StreamUtils;
|
||||
import org.springframework.web.util.DefaultUriBuilderFactory;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.BDDMockito.any;
|
||||
import static org.mockito.BDDMockito.eq;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.mock;
|
||||
import static org.mockito.BDDMockito.verify;
|
||||
import static org.mockito.BDDMockito.willThrow;
|
||||
import static org.springframework.http.MediaType.parseMediaType;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
|
|
@ -706,9 +716,7 @@ public class RestTemplateTests {
|
|||
verify(response).close();
|
||||
}
|
||||
|
||||
// Issue: SPR-9325, SPR-13860
|
||||
|
||||
@Test
|
||||
@Test // Issue: SPR-9325, SPR-13860
|
||||
public void ioException() throws Exception {
|
||||
String url = "http://example.com/resource?access_token=123";
|
||||
|
||||
|
|
@ -729,18 +737,15 @@ public class RestTemplateTests {
|
|||
ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@Test // SPR-15900
|
||||
public void ioExceptionWithEmptyQueryString() throws Exception {
|
||||
|
||||
String scheme = "http";
|
||||
String authority = "example.com";
|
||||
String path = "/resource";
|
||||
URI uri = new URI(scheme, authority, path, "", null); // http://example.com/resource?
|
||||
|
||||
|
||||
// http://example.com/resource?
|
||||
URI uri = new URI("http", "example.com", "/resource", "", null);
|
||||
|
||||
given(converter.canRead(String.class, null)).willReturn(true);
|
||||
MediaType mediaType = new MediaType("foo", "bar");
|
||||
given(converter.getSupportedMediaTypes()).willReturn(Collections.singletonList(mediaType));
|
||||
given(converter.getSupportedMediaTypes()).willReturn(Collections.singletonList(parseMediaType("foo/bar")));
|
||||
given(requestFactory.createRequest(uri, HttpMethod.GET)).willReturn(request);
|
||||
given(request.getHeaders()).willReturn(new HttpHeaders());
|
||||
given(request.execute()).willThrow(new IOException("Socket failure"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue