### Question:
HabitStatisticController { @ApiOperation(value = "Add habit statistic.") @ApiResponses(value = { @ApiResponse(code = 201, message = HttpStatuses.CREATED, response = AddHabitStatisticDto.class), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @PostMapping("/statistic/") public ResponseEntity<Object> save(@Valid @RequestBody AddHabitStatisticDto addHabitStatisticDto) { return ResponseEntity.status(HttpStatus.CREATED) .body(habitStatisticService.save(addHabitStatisticDto)); }  @ApiOperation(value = "Add habit statistic.") @ApiResponses(value = { @ApiResponse(code = 201, message = HttpStatuses.CREATED, response = AddHabitStatisticDto.class), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @PostMapping("/statistic/") ResponseEntity<Object> save(@Valid @RequestBody AddHabitStatisticDto addHabitStatisticDto); @ApiOperation(value = "Update habit statistic.") @ApiResponses(value = { @ApiResponse(code = 201, message = HttpStatuses.CREATED), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN) }) @PatchMapping("/statistic/{habitStatisticId}") ResponseEntity<UpdateHabitStatisticDto> update(
        @PathVariable Long habitStatisticId, @Valid @RequestBody UpdateHabitStatisticDto habitStatisticForUpdateDto); @ApiOperation(value = "Find statistic by habit id.") @GetMapping("/statistic/{habitId}") ResponseEntity<List<HabitStatisticDto>> findAllByHabitId(
        @PathVariable Long habitId); @ApiOperation(value = "Get today's statistic for all habit items") @ApiResponses(value = { @ApiResponse(code = 200, message = HttpStatuses.OK, response = List.class), @ApiResponse(code = 303, message = HttpStatuses.SEE_OTHER), @ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST), @ApiResponse(code = 403, message = HttpStatuses.FORBIDDEN), }) @GetMapping("/statistic/todayStatisticsForAllHabitItems") ResponseEntity<List<HabitItemsAmountStatisticDto>> getTodayStatisticsForAllHabitItems(
        @ApiParam(value = "Requested language code")
        @RequestParam(defaultValue = "en") String language
    );  }### Answer:
@Test public void saveTest() throws Exception { when(habitStatisticService.save(any(AddHabitStatisticDto.class))) .thenReturn(new AddHabitStatisticDto()); mockMvc.perform(post(habitStatisticLink) .content("{\n" + "\"amountOfItems\": 0,\n" + "\"createdOn\": \"2020-01-01T00:00:00.000Z\",\n" + "\"habitId\": 0,\n" + "\"habitRate\": \"DEFAULT\",\n" + "\"id\": 0\n}") .accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isCreated()); verify(habitStatisticService, times(1)).save(any(AddHabitStatisticDto.class)); }