BaseResponse { public void logResponse() { try { StringBuilder sb = new StringBuilder(); sb.append("RESPONSE HTTP CODE: " + this.httpCode).append(NEWLINE); sb.append("RESPONSE HTTP MSG: " + this.rspMessage).append(NEWLINE); sb.append("RESPONSE TIME: " + responseTime).append(NEWLINE); sb.append("RESPONSE SIZE: " + responseByteArray.length).append(NEWLINE); for (Entry<String, String> mapEntry : headers.entrySet()) { sb.append("RESPONSE HEADER: " + (String) mapEntry.getKey() + " = " + (String) mapEntry.getValue()).append(NEWLINE); } for (Entry<String, String> entry : cookies.entrySet()) { sb.append("RESPONSE COOKIE: " + entry.getKey() + " = " + entry.getValue()).append(NEWLINE); } if (response != null) { String contentType = this.headers.get("Content-Type"); if (isDataType(contentType)) { sb.append("RESPONSE BODY: " + this.response).append(NEWLINE); } else { sb.append("RESPONSE BODY: not logged because " + contentType + " is not a data type.").append(NEWLINE); } } this.responseLogMsg = sb.toString(); LOG.debug("******** RESPONSE ***********"); LOG.debug(this.responseLogMsg); } catch (Exception ex) { LOG.error("Error processing response: " + ex.getMessage(), ex); } }  abstract String getValue(String key); String getLogMsg(); int getHttpCode(); void setHttpCode(int code); void setHttpMessage(String msg); void setHeader(String key, String value); String getHttpMsg(); String getHttpHeader(String header); Map<String, String> getHeaders(); void setResponseTime(long time); long getResponseTime(); void setResponseBody(String body); void setResponseBody(byte[] byteArray); String getResponseBody(); String getBody(); byte[] getResponseBytes(); int getResponseSize(); String getCookie(String key); void setCookie(String key, String value); Map<String, String> getCookies(); void logResponse(); static final boolean isDataType(String contentType);  }
@Test public void testLogResponse_1() throws Exception { MockResponse fixture = new MockResponse(); fixture.responseTime = 1L; fixture.httpCode = 1; fixture.response = ""; fixture.responseByteArray = new byte[] {}; fixture.rspMessage = ""; fixture.responseLogMsg = ""; fixture.logResponse(); }
@Test public void testLogResponse_2() throws Exception { MockResponse fixture = new MockResponse(); fixture.responseTime = 1L; fixture.httpCode = 1; fixture.response = null; fixture.responseByteArray = new byte[] {}; fixture.rspMessage = ""; fixture.responseLogMsg = ""; fixture.logResponse(); }
@Test public void testLogResponse_3() throws Exception { MockResponse fixture = new MockResponse(); fixture.responseTime = 1L; fixture.httpCode = 1; fixture.response = ""; fixture.responseByteArray = new byte[] {}; fixture.rspMessage = ""; fixture.responseLogMsg = ""; fixture.logResponse(); }
@Test public void testLogResponse_4() throws Exception { MockResponse fixture = new MockResponse(); fixture.responseTime = 1L; fixture.httpCode = 1; fixture.response = ""; fixture.responseByteArray = new byte[] {}; fixture.rspMessage = ""; fixture.responseLogMsg = ""; fixture.logResponse(); }
@Test public void testLogResponse_5() throws Exception { MockResponse fixture = new MockResponse(); fixture.responseTime = 1L; fixture.httpCode = 1; fixture.response = ""; fixture.responseByteArray = new byte[] {}; fixture.rspMessage = ""; fixture.responseLogMsg = ""; fixture.logResponse(); }
@Test public void testLogResponse_6() throws Exception { MockResponse fixture = new MockResponse(); fixture.responseTime = 1L; fixture.httpCode = 1; fixture.response = ""; fixture.responseByteArray = new byte[] {}; fixture.rspMessage = ""; fixture.responseLogMsg = ""; fixture.logResponse(); }
@Test public void testLogResponse_7() throws Exception { MockResponse fixture = new MockResponse(); fixture.responseTime = 1L; fixture.httpCode = 1; fixture.response = ""; fixture.responseByteArray = new byte[] {}; fixture.rspMessage = ""; fixture.responseLogMsg = ""; fixture.logResponse(); }