### Question:
HabitStatisticController { @ApiOperation(value = "Find statistic by habit id.") @GetMapping("/statistic/{habitId}") public ResponseEntity<List<HabitStatisticDto>> findAllByHabitId( @PathVariable Long habitId) { return ResponseEntity.status(HttpStatus.OK) .body(habitStatisticService.findAllByHabitId(habitId)); }  @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 findAllByHabitIdTest() throws Exception { when(habitStatisticService.findAllByHabitId(anyLong())) .thenReturn(Collections.singletonList((new HabitStatisticDto()))); mockMvc.perform(get(habitStatisticLink + "/{habitId}", 1)) .andExpect(status().isOk()); }