CommentService { public List<Comment> loadCommentsByProject(String projectId) { final ProjectEntity project = projectService.loadProjectEntity(projectId); return commentRepository.findByProject(project).stream().map(Comment::new).collect(Collectors.toList()); } @Autowired  CommentService(CommentRepository commentRepository, ProjectService projectService, UserService userService, UserNotificationService userNotificationService); void addComment(Comment comment, String projectId, String commentingUserEmail); List<Comment> loadCommentsByProject(String projectId);  }
@Test public void loadCommentsByProject_ShouldReturnViewRepresentation() throws Exception { prepareProjectServiceMock(); prepareCommentRepositoryMock(); final List<Comment> res = commentService.loadCommentsByProject(EXISTING_PROJECT_ID); assertThat(res.size(), is(1)); assertThat(res.get(0), is(new Comment(aComment))); }