Skip to content

Commit 3d61f7b

Browse files
committed
Polish
1 parent 81dfadc commit 3d61f7b

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,18 @@
4545
import org.springframework.util.StreamUtils;
4646
import org.springframework.web.util.DefaultUriBuilderFactory;
4747

48-
import static org.junit.Assert.*;
49-
import static org.mockito.BDDMockito.*;
48+
import static org.junit.Assert.assertEquals;
49+
import static org.junit.Assert.assertFalse;
50+
import static org.junit.Assert.assertNull;
51+
import static org.junit.Assert.assertSame;
52+
import static org.junit.Assert.fail;
53+
import static org.mockito.BDDMockito.any;
54+
import static org.mockito.BDDMockito.eq;
55+
import static org.mockito.BDDMockito.given;
56+
import static org.mockito.BDDMockito.mock;
57+
import static org.mockito.BDDMockito.verify;
58+
import static org.mockito.BDDMockito.willThrow;
59+
import static org.springframework.http.MediaType.parseMediaType;
5060

5161
/**
5262
* @author Arjen Poutsma
@@ -706,9 +716,7 @@ public void optionsForAllow() throws Exception {
706716
verify(response).close();
707717
}
708718

709-
// Issue: SPR-9325, SPR-13860
710-
711-
@Test
719+
@Test // Issue: SPR-9325, SPR-13860
712720
public void ioException() throws Exception {
713721
String url = "http://example.com/resource?access_token=123";
714722

@@ -729,18 +737,15 @@ public void ioException() throws Exception {
729737
ex.getMessage());
730738
}
731739
}
732-
733-
@Test
740+
741+
@Test // SPR-15900
734742
public void ioExceptionWithEmptyQueryString() throws Exception {
735-
736-
String scheme = "http";
737-
String authority = "example.com";
738-
String path = "/resource";
739-
URI uri = new URI(scheme, authority, path, "", null); // http://example.com/resource?
740-
743+
744+
// http://example.com/resource?
745+
URI uri = new URI("http", "example.com", "/resource", "", null);
746+
741747
given(converter.canRead(String.class, null)).willReturn(true);
742-
MediaType mediaType = new MediaType("foo", "bar");
743-
given(converter.getSupportedMediaTypes()).willReturn(Collections.singletonList(mediaType));
748+
given(converter.getSupportedMediaTypes()).willReturn(Collections.singletonList(parseMediaType("foo/bar")));
744749
given(requestFactory.createRequest(uri, HttpMethod.GET)).willReturn(request);
745750
given(request.getHeaders()).willReturn(new HttpHeaders());
746751
given(request.execute()).willThrow(new IOException("Socket failure"));

0 commit comments

Comments
 (0)