### Question:
DownloadController { @GetMapping(V1_DOWNLOAD) public ResponseEntity<byte[]> download(@RequestParam("url") String downloadUrl, @RequestHeader Map<String, String> headers) { RequestHeaders requestHeaders = RequestHeaders.fromMap(headers); Response<byte[]> response = downloadService.download(downloadUrl, requestHeaders); return ResponseEntity.status(HttpStatus.OK) .headers(headersMapper.toHttpHeaders(response.getHeaders())) .body(response.getBody()); } DownloadController(DownloadService downloadService, HeadersMapper headersMapper); @GetMapping(V1_DOWNLOAD) ResponseEntity<byte[]> download(@RequestParam("url") String downloadUrl,
                                           @RequestHeader Map<String, String> headers);  }### Answer:
@Test void download() throws Exception { when(downloadService.download(eq(DOWNLOAD_URL), any())) .thenReturn(RESPONSE); when(headersMapper.toHttpHeaders(any())) .thenReturn(new HttpHeaders()); MvcResult mvcResult = mockMvc.perform(get("/v1/download") .param("url", DOWNLOAD_URL) .header(RequestHeaders.X_GTW_ASPSP_ID, "db") .header(RequestHeaders.X_REQUEST_ID, UUID.randomUUID())) .andExpect(status().is(HttpStatus.OK.value())) .andReturn(); MockHttpServletResponse response = mvcResult.getResponse(); assertThat(response.getStatus()).isEqualTo(HTTP_CODE_200); assertThat(response.getContentAsByteArray()).isEqualTo(RESPONSE_BODY); }