### Question:
ArticleController { @GetMapping("/articles/tag/{name}") public Response findByTag(@PathVariable("name") String name, @RequestParam(name = "page", defaultValue = "1") int page, @RequestParam(name = "count", defaultValue = "10") int count) { return ResponseUtil.success(articleService.findByTag(name, page, count)); }  @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 findByTag() { try { String tagName = "NoSuchTag"; mockMvc.perform(MockMvcRequestBuilders.get("/articles/tag/" + tagName + "?page=1&count=10")) .andExpect(status().is(200)) .andDo(result -> { assertEquals(TAG_NOT_EXIST.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code)); }); tagName = "linux"; mockMvc.perform(MockMvcRequestBuilders.get("/articles/tag/" + tagName + "?page=1&count=10")) .andExpect(status().is(200)) .andDo(result -> { JSONObject jsonObject = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), jsonObject.getInt(Code)); PageInfo pageInfo = (PageInfo) JSONObject.toBean(jsonObject.getJSONObject(Result), PageInfo.class); assertNotEquals(0, pageInfo.getTotal()); assertNotEquals(0, pageInfo.getStartRow()); assertNotEquals(0, pageInfo.getEndRow()); assertEquals(1, pageInfo.getPageNum()); assertEquals(10, pageInfo.getPageSize()); for (Object arc : pageInfo.getList()) { JSONObject jsonObject1 = JSONObject.fromObject(arc); assertNotEquals(0, jsonObject1.getInt("id")); assertNotNull(jsonObject1.getString("title")); assertNotNull(jsonObject1.getString("summary")); } }); } catch (Exception e) { e.printStackTrace(); } }