@Test public void deleteByIdTest() { Comment comment = ModelUtils.getComment(); when(placeCommentRepo.findById(anyLong())).thenReturn(Optional.of(comment)); doNothing().when(placeCommentRepo).delete(comment); placeCommentService.deleteById(1L); verify(placeCommentRepo, times(1)).delete(comment); }
@Override public void deleteById(Long id) { placeCommentRepo.delete(placeCommentRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.COMMENT_NOT_FOUND_EXCEPTION))); }
PlaceCommentServiceImpl implements PlaceCommentService { @Override public void deleteById(Long id) { placeCommentRepo.delete(placeCommentRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.COMMENT_NOT_FOUND_EXCEPTION))); } }
PlaceCommentServiceImpl implements PlaceCommentService { @Override public void deleteById(Long id) { placeCommentRepo.delete(placeCommentRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.COMMENT_NOT_FOUND_EXCEPTION))); }  }
PlaceCommentServiceImpl implements PlaceCommentService { @Override public void deleteById(Long id) { placeCommentRepo.delete(placeCommentRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.COMMENT_NOT_FOUND_EXCEPTION))); }  @Override CommentReturnDto findById(Long id); @Override CommentReturnDto save(Long placeId, AddCommentDto addCommentDto, String email); @Override void deleteById(Long id); @Override PageableDto getAllComments(Pageable pageable); }
PlaceCommentServiceImpl implements PlaceCommentService { @Override public void deleteById(Long id) { placeCommentRepo.delete(placeCommentRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.COMMENT_NOT_FOUND_EXCEPTION))); }  @Override CommentReturnDto findById(Long id); @Override CommentReturnDto save(Long placeId, AddCommentDto addCommentDto, String email); @Override void deleteById(Long id); @Override PageableDto getAllComments(Pageable pageable);  }