45
45
import org .springframework .util .StreamUtils ;
46
46
import org .springframework .web .util .DefaultUriBuilderFactory ;
47
47
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 ;
50
60
51
61
/**
52
62
* @author Arjen Poutsma
@@ -706,9 +716,7 @@ public void optionsForAllow() throws Exception {
706
716
verify (response ).close ();
707
717
}
708
718
709
- // Issue: SPR-9325, SPR-13860
710
-
711
- @ Test
719
+ @ Test // Issue: SPR-9325, SPR-13860
712
720
public void ioException () throws Exception {
713
721
String url = "http://example.com/resource?access_token=123" ;
714
722
@@ -729,18 +737,15 @@ public void ioException() throws Exception {
729
737
ex .getMessage ());
730
738
}
731
739
}
732
-
733
- @ Test
740
+
741
+ @ Test // SPR-15900
734
742
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
+
741
747
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" )));
744
749
given (requestFactory .createRequest (uri , HttpMethod .GET )).willReturn (request );
745
750
given (request .getHeaders ()).willReturn (new HttpHeaders ());
746
751
given (request .execute ()).willThrow (new IOException ("Socket failure" ));
0 commit comments