### Question:
InboxController { @SneakyThrows @GetMapping(value = "/inbox/document/{path:.*}", produces = APPLICATION_OCTET_STREAM_VALUE) @ApiOperation("Read document from inbox") @ApiResponses(value = { @ApiResponse(code = 200, message = "Document was successfully read"), @ApiResponse(code = 404, message = "Document not found") }) public void readFromInbox(@RequestHeader String user, @RequestHeader String password, @PathVariable String path, HttpServletResponse response) { UserIDAuth userIDAuth = new UserIDAuth(new UserID(user), ReadKeyPasswordHelper.getForString(password)); PrivateResource resource = BasePrivateResource.forPrivate(path); response.addHeader(CONTENT_TYPE, APPLICATION_OCTET_STREAM_VALUE); try (InputStream is = dataSafeService.inboxService().read(ReadRequest.forPrivate(userIDAuth, resource)); OutputStream os = response.getOutputStream()) { StreamUtils.copy(is, os); } log.debug("User {}, read from INBOX file {}", user, resource); }  @SneakyThrows @PutMapping(value = "/inbox/document/{path:.*}", consumes = MULTIPART_FORM_DATA_VALUE) @ApiOperation("Send document to inbox") @ApiResponses(value = { @ApiResponse(code = 200, message = "Document was successfully sent"), @ApiResponse(code = 403, message = "Access denied") }) void writeToInbox(@RequestHeader Set<String> users,
                             @PathVariable String path,
                             @RequestParam("file") MultipartFile file); @SneakyThrows @GetMapping(value = "/inbox/document/{path:.*}", produces = APPLICATION_OCTET_STREAM_VALUE) @ApiOperation("Read document from inbox") @ApiResponses(value = { @ApiResponse(code = 200, message = "Document was successfully read"), @ApiResponse(code = 404, message = "Document not found") }) void readFromInbox(@RequestHeader String user,
                              @RequestHeader String password,
                              @PathVariable String path,
                              HttpServletResponse response); @DeleteMapping("/inbox/document/{path:.*}") @ApiOperation("Delete document from inbox") @ApiResponses(value = { @ApiResponse(code = 200, message = "Document successfully deleted") }) void deleteFromInbox(@RequestHeader String user,
                                @RequestHeader String password,
                                @PathVariable String path); @GetMapping(value = "/inbox/documents/{path:.*}", produces = APPLICATION_JSON_VALUE) @ApiOperation("List files in inbox") @ApiResponses(value = { @ApiResponse(code = 200, message = "List command successfully completed"), @ApiResponse(code = 401, message = "Unauthorised") }) List<String> listInbox(@RequestHeader String user,
                                  @RequestHeader String password,
                                  @ApiParam(defaultValue = ".")
                                  @PathVariable(required = false) String path);  }### Answer:
@SneakyThrows @Test void readFromInboxTest() { when(dataSafeService.inboxService().read(any())).thenReturn(new ByteArrayInputStream("hello".getBytes())); RestDocumentationResultHandler document = document("inbox-read-success", pathParameters( parameterWithName("path").description("path to the file") ), requestHeaders( headerWithName("token").description(TOKEN_DESCRIPTION), headerWithName("user").description(USER_DESCRIPTION), headerWithName("password").description(PASSWORD_DESCRIPTION) ) ); when(dataSafeService.inboxService().read(any())).thenReturn(new ByteArrayInputStream("hello".getBytes())); mvc.perform(get("/inbox/document/{path}", TEST_PATH) .header("user", TEST_USER) .header("password", TEST_PASS) .header("token", token) .accept(MediaType.APPLICATION_OCTET_STREAM_VALUE)) .andExpect(status().isOk()) .andExpect(header().string(CONTENT_TYPE, APPLICATION_OCTET_STREAM_VALUE)) .andDo(document); verify(inboxService).read(any()); }