1111import java .io .ByteArrayInputStream ;
1212import java .io .IOException ;
1313import java .io .InputStream ;
14+ import java .security .cert .Certificate ;
1415
1516public class HttpResponseParserTest {
1617
18+ private final Certificate [] mServerCertificates = new Certificate []{};
19+
1720 @ Test
1821 public void parseHttpResponse_withValidResponse_succeeds () throws Exception {
1922 // Arrange
@@ -28,7 +31,7 @@ public void parseHttpResponse_withValidResponse_succeeds() throws Exception {
2831 HttpResponseParser parser = new HttpResponseParser ();
2932
3033 // Act
31- HttpResponse response = parser .parseHttpResponse (inputStream , serverCertificates );
34+ HttpResponse response = parser .parseHttpResponse (inputStream , mServerCertificates );
3235
3336 // Assert
3437 assertNotNull ("Response should not be null" , response );
@@ -51,7 +54,7 @@ public void parseHttpResponse_withErrorStatus_returnsErrorResponse() throws Exce
5154 HttpResponseParser parser = new HttpResponseParser ();
5255
5356 // Act
54- HttpResponse response = parser .parseHttpResponse (inputStream , serverCertificates );
57+ HttpResponse response = parser .parseHttpResponse (inputStream , mServerCertificates );
5558
5659 // Assert
5760 assertNotNull ("Response should not be null" , response );
@@ -76,7 +79,7 @@ public void parseHttpResponse_withNoContentLength_readsUntilEnd() throws Excepti
7679 HttpResponseParser parser = new HttpResponseParser ();
7780
7881 // Act
79- HttpResponse response = parser .parseHttpResponse (inputStream , serverCertificates );
82+ HttpResponse response = parser .parseHttpResponse (inputStream , mServerCertificates );
8083
8184 // Assert
8285 assertNotNull ("Response should not be null" , response );
@@ -100,7 +103,7 @@ public void parseHttpResponse_withNoBody_returnsEmptyData() throws Exception {
100103 HttpResponseParser parser = new HttpResponseParser ();
101104
102105 // Act
103- HttpResponse response = parser .parseHttpResponse (inputStream , serverCertificates );
106+ HttpResponse response = parser .parseHttpResponse (inputStream , mServerCertificates );
104107
105108 // Assert
106109 assertNotNull ("Response should not be null" , response );
@@ -119,7 +122,7 @@ public void parseHttpResponse_withInvalidStatusLine_throwsException() throws Exc
119122
120123 // Act & Assert
121124 try {
122- parser .parseHttpResponse (inputStream , serverCertificates );
125+ parser .parseHttpResponse (inputStream , mServerCertificates );
123126 fail ("Should have thrown exception for invalid status line" );
124127 } catch (IOException e ) {
125128 assertTrue ("Exception should mention invalid status" ,
@@ -135,7 +138,7 @@ public void parseHttpResponse_withEmptyStream_throwsException() throws Exception
135138
136139 // Act & Assert
137140 try {
138- parser .parseHttpResponse (inputStream , serverCertificates );
141+ parser .parseHttpResponse (inputStream , mServerCertificates );
139142 fail ("Should have thrown exception for empty stream" );
140143 } catch (IOException e ) {
141144 assertTrue ("Exception should mention no response" ,
@@ -160,7 +163,7 @@ public void parseHttpResponse_withChunkedEncoding_handlesCorrectly() throws Exce
160163 HttpResponseParser parser = new HttpResponseParser ();
161164
162165 // Act
163- HttpResponse response = parser .parseHttpResponse (inputStream , serverCertificates );
166+ HttpResponse response = parser .parseHttpResponse (inputStream , mServerCertificates );
164167
165168 // Assert
166169 assertNotNull ("Response should not be null" , response );
0 commit comments