File tree Expand file tree Collapse file tree 2 files changed +31
-38
lines changed
google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5 Expand file tree Collapse file tree 2 files changed +31
-38
lines changed Original file line number Diff line number Diff line change 1414
1515package com .google .api .client .http .apache .v5 ;
1616
17+ import static org .junit .Assert .assertNotNull ;
18+
19+ import java .io .InputStream ;
1720import org .apache .hc .client5 .http .classic .methods .HttpPost ;
1821import org .apache .hc .client5 .http .classic .methods .HttpUriRequestBase ;
1922import org .junit .Test ;
20- import java .io .InputStream ;
21-
22- import static org .junit .Assert .assertNotNull ;
2323
2424public class Apache5HttpResponseTest {
25- @ Test
26- public void testNullContent () throws Exception {
27- HttpUriRequestBase base = new HttpPost ("http://www.google.com" );
28- MockClassicHttpResponse mockResponse = new MockClassicHttpResponse ();
29- mockResponse .setEntity (null );
30- Apache5HttpResponse response =
31- new Apache5HttpResponse (
32- base ,
33- mockResponse );
25+ @ Test
26+ public void testNullContent () throws Exception {
27+ HttpUriRequestBase base = new HttpPost ("http://www.google.com" );
28+ MockClassicHttpResponse mockResponse = new MockClassicHttpResponse ();
29+ mockResponse .setEntity (null );
30+ Apache5HttpResponse response = new Apache5HttpResponse (base , mockResponse );
3431
35- InputStream content =
36- response .getContent ();
32+ InputStream content = response .getContent ();
3733
38- assertNotNull (content );
39- }
34+ assertNotNull (content );
35+ }
4036}
Original file line number Diff line number Diff line change 1919import org .junit .Test ;
2020
2121public class Apache5ResponseContentTest {
22- @ Test
23- public void testNullResponseContent_doesNotThrowExceptionOnClose () throws Exception {
24- Apache5ResponseContent response =
25- new Apache5ResponseContent (
26- new InputStream () {
27- @ Override
28- public int read () throws IOException {
29- return 0 ;
30- }
31- },
32- null );
22+ @ Test
23+ public void testNullResponseContent_doesNotThrowExceptionOnClose () throws Exception {
24+ Apache5ResponseContent response =
25+ new Apache5ResponseContent (
26+ new InputStream () {
27+ @ Override
28+ public int read () throws IOException {
29+ return 0 ;
30+ }
31+ },
32+ null );
3333
34- response .close ();
35- }
34+ response .close ();
35+ }
3636
37- @ Test
38- public void testNullWrappedContent_doesNotThrowExceptionOnClose () throws Exception {
39- MockClassicHttpResponse mockResponse = new MockClassicHttpResponse ();
40- Apache5ResponseContent response =
41- new Apache5ResponseContent (
42- null ,
43- mockResponse );
37+ @ Test
38+ public void testNullWrappedContent_doesNotThrowExceptionOnClose () throws Exception {
39+ MockClassicHttpResponse mockResponse = new MockClassicHttpResponse ();
40+ Apache5ResponseContent response = new Apache5ResponseContent (null , mockResponse );
4441
45- response .close ();
46- }
42+ response .close ();
43+ }
4744}
You can’t perform that action at this time.
0 commit comments