### Question:
LoggingContextInterceptor implements ClientHttpRequestInterceptor { @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { RequestInfo requestInformation = loggingContextService.getRequestInformation(); HttpHeaders requestHeaders = request.getHeaders(); requestHeaders.add(INTERNAL_REQUEST_ID_HEADER_NAME, requestInformation.getInternalRequestId()); requestHeaders.add(X_REQUEST_ID_HEADER_NAME, requestInformation.getXRequestId()); return execution.execute(request, body); }  @Override ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution);  }### Answer:
@Test void intercept() throws IOException { when(loggingContextService.getRequestInformation()).thenReturn(new RequestInfo(INTERNAL_REQUEST_ID, X_REQUEST_ID, INSTANCE_ID)); ClientHttpResponse actualResponse = loggingContextInterceptor.intercept(mockHttpRequest, REQUEST_BODY, mockClientHttpRequestExecution); assertEquals(mockClientHttpResponse, actualResponse); verify(mockClientHttpRequestExecution).execute(httpRequestArgumentCaptor.capture(), eq(REQUEST_BODY)); HttpHeaders capturedHeaders = httpRequestArgumentCaptor.getValue().getHeaders(); assertEquals(capturedHeaders.getFirst(INTERNAL_REQUEST_ID_HEADER_NAME), INTERNAL_REQUEST_ID); assertEquals(capturedHeaders.getFirst(X_REQUEST_ID_HEADER_NAME), X_REQUEST_ID); }
@Test void intercept_noValues() throws IOException { when(loggingContextService.getRequestInformation()).thenReturn(new RequestInfo(null, null, null)); ClientHttpResponse actualResponse = loggingContextInterceptor.intercept(mockHttpRequest, REQUEST_BODY, mockClientHttpRequestExecution); assertEquals(mockClientHttpResponse, actualResponse); verify(mockClientHttpRequestExecution).execute(httpRequestArgumentCaptor.capture(), eq(REQUEST_BODY)); HttpHeaders capturedHeaders = httpRequestArgumentCaptor.getValue().getHeaders(); assertNull(capturedHeaders.getFirst(INTERNAL_REQUEST_ID_HEADER_NAME)); assertNull(capturedHeaders.getFirst(X_REQUEST_ID_HEADER_NAME)); }