@Test public void getPage() throws Exception { mockMvc.perform(get("/categories")).andExpect(status().isOk()) .andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); JSONArray jsonArray = object.getJSONArray(Result); assertNotNull(jsonArray); jsonArray.forEach(o -> { Category c = (Category) JSONObject.toBean(JSONObject.fromObject(o), Category.class); assertNotNull(c.getName()); assertNotNull(c.getId()); assertNotNull(c.getArticles()); }); }); }
@GetMapping("/categories") public Response getPage() { return ResponseUtil.success(categoryService.retrievePage()); }
CategoryController { @GetMapping("/categories") public Response getPage() { return ResponseUtil.success(categoryService.retrievePage()); } }
CategoryController { @GetMapping("/categories") public Response getPage() { return ResponseUtil.success(categoryService.retrievePage()); }  }
CategoryController { @GetMapping("/categories") public Response getPage() { return ResponseUtil.success(categoryService.retrievePage()); }  @PostMapping("/admin/category/create") Response addOne(@RequestParam("name") String name); @DeleteMapping("/admin/category/del") Response deleteOne(@RequestParam("id") long id); @PutMapping("/admin/category/update") Response updateOne(@RequestParam("id") Long id,
                              @RequestParam("name") String name); @GetMapping("/categories") Response getPage(); }
CategoryController { @GetMapping("/categories") public Response getPage() { return ResponseUtil.success(categoryService.retrievePage()); }  @PostMapping("/admin/category/create") Response addOne(@RequestParam("name") String name); @DeleteMapping("/admin/category/del") Response deleteOne(@RequestParam("id") long id); @PutMapping("/admin/category/update") Response updateOne(@RequestParam("id") Long id,
                              @RequestParam("name") String name); @GetMapping("/categories") Response getPage();  }