### Question:
HttpMessageLoggingInterceptor implements HttpInterceptor { @Override public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) { boolean secure = chain.context().isSecure(); logger.logRequest(request, null, secure); return chain.proceed(request).map(response -> { logger.logResponse(request, response, secure); return response; }); } HttpMessageLoggingInterceptor(boolean longFormatEnabled, HttpMessageFormatter httpMessageFormatter); @Override Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain);  }### Answer:
@Test public void logsRequestsAndResponses() { LiveHttpRequest request = get("/") .version(HttpVersion.HTTP_1_1) .header("ReqHeader", "ReqHeaderValue") .cookies(requestCookie("ReqCookie", "ReqCookieValue")) .build(); consume(interceptor.intercept(request, chain( response(OK) .header("RespHeader", "RespHeaderValue") .cookies(responseCookie("RespCookie", "RespCookieValue").build()) ))); assertThat(responseLogSupport.log(), contains( loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, origin=null, request=" + FORMATTED_REQUEST), loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, response=" + FORMATTED_RESPONSE))); }
@Test public void logsRequestsAndResponsesShort() { interceptor = new HttpMessageLoggingInterceptor(false, httpMessageFormatter); LiveHttpRequest request = get("/") .header("ReqHeader", "ReqHeaderValue") .cookies(requestCookie("ReqCookie", "ReqCookieValue")) .build(); consume(interceptor.intercept(request, chain( response(OK) .header("RespHeader", "RespHeaderValue") .cookies(responseCookie("RespCookie", "RespCookieValue").build()) ))); String requestPattern = "request=\\{version=HTTP/1.1, method=GET, uri=/, id=" + request.id() + "\\}"; String responsePattern = "response=\\{version=HTTP/1.1, status=200 OK\\}"; assertThat(responseLogSupport.log(), contains( loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, origin=null, " + requestPattern), loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, " + responsePattern))); }
@Test public void logsSecureRequests() { LiveHttpRequest request = get("/") .header("ReqHeader", "ReqHeaderValue") .cookies(requestCookie("ReqCookie", "ReqCookieValue")) .build(); consume(interceptor.intercept(request, chain(response(OK)))); assertThat(responseLogSupport.log(), contains( loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, origin=null, request=" + FORMATTED_REQUEST), loggingEvent(INFO, "requestId=" + request.id() + ", secure=true, response=" + FORMATTED_RESPONSE))); }