### Question:
CodeReviewCommentController { @RequestMapping(value = "/reviews/{postId}", method = RequestMethod.GET) @ResponseBody public JsonResponse getCodeReview(@PathVariable("postId") Long postId) throws NotFoundException { Post post = postService.get(postId); CodeReviewDto postDto = new CodeReviewDto(post); for (CodeReviewCommentDto postComment : postDto.getComments()) { postComment.setBody(bbCodeService.convertBbToHtml(postComment.getBody())); } return new JsonResponse(JsonResponseStatus.SUCCESS, postDto); } @Autowired  CodeReviewCommentController(PostCommentService postCommentService,
                                       PostService postService,
                                       BBCodeService bbCodeService); @InitBinder void initBinder(WebDataBinder binder); @RequestMapping(value = "/reviews/{postId}", method = RequestMethod.GET) @ResponseBody JsonResponse getCodeReview(@PathVariable("postId") Long postId); @RequestMapping(value = "/review/comment/edit/{commentId}", method = RequestMethod.GET) @ResponseBody JsonResponse getCodeReviewCommentForEdit(@PathVariable("commentId") Long commentId); @RequestMapping(value = "/review/comment/render/{commentId}", method = RequestMethod.GET) @ResponseBody JsonResponse getCodeReviewCommentForRender(@PathVariable("commentId") Long commentId); @RequestMapping(value="/reviewcomments/new", method = RequestMethod.POST) @ResponseBody JsonResponse addComment(
            @Valid @ModelAttribute CodeReviewCommentDto commentDto,
            BindingResult bindingResult,
            @RequestParam("postId") Long postId); @RequestMapping(value = "/reviewcomments/delete", method = RequestMethod.GET) @ResponseBody JsonResponse deleteComment(
            @RequestParam(COMMENT_ID) Long commentId,
            @RequestParam(POST_ID) Long postId); @RequestMapping(value="/reviewcomments/edit", method = RequestMethod.POST) @ResponseBody JsonResponse editComment(
            @Valid @ModelAttribute CodeReviewCommentDto commentDto,
            BindingResult bindingResult,
            @RequestParam("branchId") long branchId); @ExceptionHandler(AccessDeniedException.class) @ResponseBody FailJsonResponse securityError(); @ExceptionHandler(NotFoundException.class) @ResponseBody FailJsonResponse entityNotFoundError(); static final String POST_ID; static final String COMMENT_ID; }### Answer:
@Test public void getCodeReviewSuccess() throws NotFoundException { Post post = new Post(currentUser(), "my beautiful code"); post.setId(POST_ID); when(postService.get(POST_ID)).thenReturn(post); JsonResponse response = controller.getCodeReview(POST_ID); assertEquals(response.getStatus(), JsonResponseStatus.SUCCESS); assertEquals(((CodeReviewDto) response.getResult()).getPostId(), POST_ID); }
@Test(expectedExceptions = NotFoundException.class) public void getCodeReviewNotFound() throws NotFoundException { when(postService.get(POST_ID)).thenThrow(new NotFoundException()); controller.getCodeReview(POST_ID); }