### Question:
QuestionsAndAnswersController implements ApplicationContextAware, PluginController { @RequestMapping(value = "/resources/icon/{name}", method = RequestMethod.GET) public void getIcon(HttpServletRequest request, HttpServletResponse response, @PathVariable("name") String name) { try { processIconRequest(request, response, PATH_TO_IMAGES + name); } catch (Exception ex) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); } }  @RequestMapping(value = "new", method = RequestMethod.GET) String showNewQuestionPage(@RequestParam(BRANCH_ID) Long branchId, Model model, HttpServletRequest request); @RequestMapping(value = "new", method = RequestMethod.POST) String createQuestion(@Valid @ModelAttribute TopicDto topicDto, BindingResult result, Model model,
                                 @RequestParam(BRANCH_ID) Long branchId, HttpServletRequest request); @RequestMapping(value = "/resources/icon/{name}", method = RequestMethod.GET) void getIcon(HttpServletRequest request, HttpServletResponse response, @PathVariable("name") String name); @RequestMapping(value = "{id}", method = RequestMethod.GET) String showQuestion(HttpServletRequest request, Model model, @PathVariable("id") Long id); @RequestMapping(value = "{id}/canpost", method = RequestMethod.GET) @ResponseBody JsonResponse canPost(@PathVariable("id") Long questionId); @RequestMapping(value = "{questionId}/post/{answerId}", method = RequestMethod.GET) String showAnswer(@PathVariable Long questionId, @PathVariable Long answerId); @RequestMapping(value = "{id}/edit", method = RequestMethod.GET) String editQuestionPage(HttpServletRequest request, Model model, @PathVariable("id") Long id); @RequestMapping(value = "{id}/edit", method = RequestMethod.POST) String updateQuestion(@Valid @ModelAttribute TopicDto topicDto, BindingResult result, Model model,
                                 @PathVariable("id") Long id, HttpServletRequest request); @RequestMapping(value = "post/{id}/edit", method = RequestMethod.GET) String editAnswerPage(HttpServletRequest request, Model model, @PathVariable("id") Long id); @RequestMapping(value = "post/{id}/edit", method = RequestMethod.POST) String updateAnswer(@Valid @ModelAttribute PostDto postDto, BindingResult result, Model model,
                                 @PathVariable("id") Long id, HttpServletRequest request); @RequestMapping(value = "{questionId}", method = RequestMethod.POST) String create(@PathVariable("questionId") Long questionId, @Valid @ModelAttribute PostDto postDto,
                               BindingResult result, Model model, HttpServletRequest request); @RequestMapping(value = "{id}/close", method = RequestMethod.GET) String closeQuestion(@PathVariable("id") Long id); @RequestMapping(value = "{id}/open", method = RequestMethod.GET) String openQuestion(@PathVariable("id") Long id); @RequestMapping(method = RequestMethod.DELETE, value = "post/{answerId}") String deleteAnswer(@PathVariable Long answerId); @Override void setApplicationContext(ApplicationContext applicationContext); void setApiPath(String apiPath); static final int LIMIT_OF_POSTS_VALUE; static final String PLUGIN_VIEW_NAME; static final String BRANCH_ID; static final String CONTENT; static final String POST_ID; static final String COMMENT_ID; }### Answer:
@Test public void testGetIcon() throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); controller.getIcon(request, response, "read.png"); assertEquals(response.getContentType(), "image/png"); assertEquals(response.getHeader("Pragma"), "public"); assertEquals(response.getHeader("Cache-Control"), "public"); }
@Test public void getIconShouldSetNotModifiedStatusIfRequestHaveIfModifiedSinceHeader() { MockHttpServletResponse response = new MockHttpServletResponse(); when(request.getHeader("If-Modified-Since")).thenReturn((new Date()).toString()); controller.getIcon(request, response, "read.png"); assertEquals(response.getStatus(), HttpServletResponse.SC_NOT_MODIFIED); }
@Test public void getIconShouldSetNotFoundStatusForIncorrectIconName() { MockHttpServletResponse response = new MockHttpServletResponse(); controller.getIcon(request, response, "incorrect"); assertEquals(response.getStatus(), HttpServletResponse.SC_NOT_FOUND); }