@Test public void findByIdTest() { Comment comment = ModelUtils.getComment(); CommentReturnDto commentReturnDto = ModelUtils.getCommentReturnDto(); when(placeCommentRepo.findById(1L)) .thenReturn(Optional.of(comment)); when(modelMapper.map(comment, CommentReturnDto.class)) .thenReturn(commentReturnDto); CommentReturnDto result = placeCommentService.findById(1L); assertEquals(1, (long) result.getId()); }
@Override public CommentReturnDto findById(Long id) { Comment comment = placeCommentRepo.findById(id).orElseThrow(() -> new NotFoundException("")); return modelMapper.map(comment, CommentReturnDto.class); }
PlaceCommentServiceImpl implements PlaceCommentService { @Override public CommentReturnDto findById(Long id) { Comment comment = placeCommentRepo.findById(id).orElseThrow(() -> new NotFoundException("")); return modelMapper.map(comment, CommentReturnDto.class); } }
PlaceCommentServiceImpl implements PlaceCommentService { @Override public CommentReturnDto findById(Long id) { Comment comment = placeCommentRepo.findById(id).orElseThrow(() -> new NotFoundException("")); return modelMapper.map(comment, CommentReturnDto.class); }  }
PlaceCommentServiceImpl implements PlaceCommentService { @Override public CommentReturnDto findById(Long id) { Comment comment = placeCommentRepo.findById(id).orElseThrow(() -> new NotFoundException("")); return modelMapper.map(comment, CommentReturnDto.class); }  @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 CommentReturnDto findById(Long id) { Comment comment = placeCommentRepo.findById(id).orElseThrow(() -> new NotFoundException("")); return modelMapper.map(comment, CommentReturnDto.class); }  @Override CommentReturnDto findById(Long id); @Override CommentReturnDto save(Long placeId, AddCommentDto addCommentDto, String email); @Override void deleteById(Long id); @Override PageableDto getAllComments(Pageable pageable);  }