### Question:
NewsSubscriberController { @ApiOperation(value = "Get all emails for sending news.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("") public ResponseEntity<List<NewsSubscriberResponseDto>> getAll() { return ResponseEntity.status(HttpStatus.OK).body(newsSubscriberService.findAll()); } @Autowired  NewsSubscriberController(NewsSubscriberService newsSubscriberService); @ApiOperation(value = "Get all emails for sending news.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("") ResponseEntity<List<NewsSubscriberResponseDto>> getAll(); @ApiOperation(value = "Save email in database for receiving news.") @ApiResponses(value = { @ApiResponse(code = 201, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @PostMapping("") ResponseEntity<NewsSubscriberRequestDto> save(
        @RequestBody @Valid NewsSubscriberRequestDto dto); @ApiOperation(value = "Deleting an email from subscribe table in database.") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("/unsubscribe") ResponseEntity<Long> delete(@RequestParam @Valid String email,
                                       @RequestParam String unsubscribeToken); final NewsSubscriberService newsSubscriberService; }### Answer:
@Test void getAll() throws Exception { when(newsSubscriberService.findAll()) .thenReturn(Collections.singletonList(new NewsSubscriberResponseDto())); mockMvc.perform(get(newsSubscriberControllerLink) .accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); verify(newsSubscriberService).findAll(); }