### Question:
BaseDownloadService extends AbstractService implements DownloadService { @Override public Response<byte[]> download(String downloadUrl, RequestHeaders requestHeaders) { requireValid(validateDownload(downloadUrl, requestHeaders)); Map<String, String> headersMap = populateGetHeaders(requestHeaders.toMap()); Response<byte[]> response = httpClient.get(modifyDownloadUrl(downloadUrl)) .headers(headersMap) .send(byteArrayResponseHandler(), requestBuilderInterceptor); return new Response<>( response.getStatusCode(), response.getBody(), modifyResponseHeaders(response.getHeaders()) ); } BaseDownloadService(String baseUri, HttpClient httpClient);  BaseDownloadService(String baseUri,
                               HttpClient httpClient,
                               Interceptor requestBuilderInterceptor); @Override Response<byte[]> download(String downloadUrl, RequestHeaders requestHeaders);  }### Answer:
@Test void download_bestCase() { when(httpClient.get(any())).thenReturn(requestBuilder); doReturn(dummyResponse()).when(requestBuilder).send(any(), any(Interceptor.class)); Response<byte[]> response = service.download(DOWNLOAD_URL, headers); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(requestBuilder, times(1)).headers(headersCaptor.capture()); assertThat(uriCaptor.getValue()).isEqualTo(DOWNLOAD_URL); assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap()); assertThat(response.getHeaders().getHeadersMap()).containsEntry(ResponseHeaders.CONTENT_TYPE, OCTET_STREAM); }
@Test void download_partialDownloadLink() { when(httpClient.get(any())).thenReturn(requestBuilder); doReturn(dummyResponse()).when(requestBuilder).send(any(), any(Interceptor.class)); Response<byte[]> response = service.download("/download", headers); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(requestBuilder, times(1)).headers(headersCaptor.capture()); assertThat(uriCaptor.getValue()).isEqualTo(DOWNLOAD_URL); assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap()); assertThat(response.getHeaders().getHeadersMap()).containsEntry(ResponseHeaders.CONTENT_TYPE, OCTET_STREAM); }
@Test void download_noProtocolLink() { when(httpClient.get(any())).thenReturn(requestBuilder); doReturn(dummyResponse()).when(requestBuilder).send(any(), any(Interceptor.class)); Response<byte[]> response = service.download("base.url/download", headers); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(requestBuilder, times(1)).headers(headersCaptor.capture()); assertThat(uriCaptor.getValue()).isEqualTo(DOWNLOAD_URL); assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap()); assertThat(response.getHeaders().getHeadersMap()).containsEntry(ResponseHeaders.CONTENT_TYPE, OCTET_STREAM); }