### Question:
ArticleController { @GetMapping("/article/articleID/{articleID}") public Response retrieveOneById(@PathVariable("articleID") long articleId, @RequestParam(value = "update", defaultValue = "false") boolean is4update, HttpServletRequest request) { ArticleModel article = articleService.retrieveOneByID(articleId, is4update); if (article.getOpen()) { return ResponseUtil.success(article); } else if (article.getAuthorId().equals(redisUserUtil.get(request).getId())) { return ResponseUtil.success(article); } return ResponseUtil.response(ResponseEnum.PERMISSION_ERROR, null); }  @PostMapping("/admin/article/create") Response create(@RequestBody ArticleReq body); @DeleteMapping("/admin/article/del") Response delete(@RequestParam("articleID") long articleId); @PutMapping("/admin/article/update") Response update(@RequestBody ArticleReq body); @GetMapping("/article/articleID/{articleID}") Response retrieveOneById(@PathVariable("articleID") long articleId,
                                    @RequestParam(value = "update", defaultValue = "false") boolean is4update,
                                    HttpServletRequest request); @GetMapping("/articles") Response articles(@RequestParam(name = "page", defaultValue = "1") int page,
                             @RequestParam(name = "count", defaultValue = "5") int count); @GetMapping("/admin/articles") Response adminArticles(@RequestParam(name = "page", defaultValue = "1") int page,
                                  @RequestParam(name = "count", defaultValue = "10") int count); @GetMapping("/articles/category/{name}") Response findByCategory(@PathVariable("name") String name,
                                   @RequestParam(name = "page", defaultValue = "1") int page,
                                   @RequestParam(name = "count", defaultValue = "10") int count); @GetMapping("/articles/tag/{name}") Response findByTag(@PathVariable("name") String name,
                              @RequestParam(name = "page", defaultValue = "1") int page,
                              @RequestParam(name = "count", defaultValue = "10") int count); @GetMapping("/createSitemap") Response createSitemap();  }### Answer:
@Test public void retrieveOneById() { try { long articleID = 3; mockMvc.perform(MockMvcRequestBuilders.get("/article/articleID/" + articleID)) .andExpect(status().is(200)); mockMvc.perform(MockMvcRequestBuilders.get("/article/articleID/" + articleID + "?update=true")) .andExpect(status().is(200)); mockMvc.perform(MockMvcRequestBuilders.get("/article/articleID/-1")) .andExpect(status().is(200)) .andDo(result -> { JSONObject jsonObject = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(ARTICLE_NOT_EXIST.getCode(), jsonObject.getInt(Code)); }); mockMvc.perform(MockMvcRequestBuilders.get("/article/articleID/" + articleID + "?update=false")) .andExpect(status().is(200)) .andDo(result -> { JSONObject articleJson = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), articleJson.getInt(Code)); assertNotNull(articleJson.getJSONObject(Result)); ArticleModel a = (ArticleModel) JSONObject.toBean(articleJson.getJSONObject(Result), ArticleModel.class); assertNotNull(a.getTitle()); assertNotNull(a.getId()); assertNotNull(a.getSummary()); assertNotNull(a.getMdContent()); assertNotNull(a.getUrl()); assertNotNull(a.getUpdateDateFormat()); assertNotNull(a.getPreArticleId()); assertNotNull(a.getPreArticleId()); assertNotNull(a.getNextArticleId()); assertNotNull(a.getNextArticleTitle()); assertNotNull(a.getReadingNumber()); assertNotNull(a.getOriginal()); assertNotNull(a.getPublishDateFormat()); assertNotNull(a.getCategory()); assertNotNull(a.getTags()); assertNotNull(a.getAuthorName()); }); } catch (Exception e) { e.printStackTrace(); } }