@Test void countCommentsTest() { when(tipsAndTricksCommentRepo.countAllByTipsAndTricksId(anyLong())).thenReturn(1); int countComments = tipsAndTricksCommentService.countComments(1L); assertEquals(1, countComments); }
@Override public int countComments(Long tipAndTricksId) { return tipsAndTricksCommentRepo.countAllByTipsAndTricksId(tipAndTricksId); }
TipsAndTricksCommentServiceImpl implements TipsAndTricksCommentService { @Override public int countComments(Long tipAndTricksId) { return tipsAndTricksCommentRepo.countAllByTipsAndTricksId(tipAndTricksId); } }
TipsAndTricksCommentServiceImpl implements TipsAndTricksCommentService { @Override public int countComments(Long tipAndTricksId) { return tipsAndTricksCommentRepo.countAllByTipsAndTricksId(tipAndTricksId); }  }
TipsAndTricksCommentServiceImpl implements TipsAndTricksCommentService { @Override public int countComments(Long tipAndTricksId) { return tipsAndTricksCommentRepo.countAllByTipsAndTricksId(tipAndTricksId); }  @Override AddTipsAndTricksCommentDtoResponse save(Long tipsandtricksId,
                                                   AddTipsAndTricksCommentDtoRequest addTipsAndTricksCommentDtoRequest,
                                                   User user); @Override PageableDto<TipsAndTricksCommentDto> findAllComments(Pageable pageable, User user, Long tipsAndTricksId); @Override List<TipsAndTricksCommentDto> findAllReplies(Long parentCommentId); @Override void deleteById(Long id, User user); @Override void update(String text, Long id, User user); @Override void like(Long id, User user); @Override int countLikes(Long id); @Override int countReplies(Long id); @Override int countComments(Long tipAndTricksId); }
TipsAndTricksCommentServiceImpl implements TipsAndTricksCommentService { @Override public int countComments(Long tipAndTricksId) { return tipsAndTricksCommentRepo.countAllByTipsAndTricksId(tipAndTricksId); }  @Override AddTipsAndTricksCommentDtoResponse save(Long tipsandtricksId,
                                                   AddTipsAndTricksCommentDtoRequest addTipsAndTricksCommentDtoRequest,
                                                   User user); @Override PageableDto<TipsAndTricksCommentDto> findAllComments(Pageable pageable, User user, Long tipsAndTricksId); @Override List<TipsAndTricksCommentDto> findAllReplies(Long parentCommentId); @Override void deleteById(Long id, User user); @Override void update(String text, Long id, User user); @Override void like(Long id, User user); @Override int countLikes(Long id); @Override int countReplies(Long id); @Override int countComments(Long tipAndTricksId);  }