@Test public void allForOpen() throws Exception { mockMvc.perform(get("/links")).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); object.getJSONArray(Result).forEach(o -> { PartnerSite site = (PartnerSite) JSONObject.toBean(JSONObject.fromObject(o), PartnerSite.class); assertNotNull(site.getUrl()); assertNull(site.getOpen()); assertNotNull(site.getName()); }); }); }
@GetMapping("/links") public Response allForOpen() { List<PartnerSite> sites = new ArrayList<>(); for (PartnerSite p : partnerSiteService.findAll()) { if (p.getOpen()) { p.setOpen(null); sites.add(p); } } return ResponseUtil.success(sites); }
LinksController { @GetMapping("/links") public Response allForOpen() { List<PartnerSite> sites = new ArrayList<>(); for (PartnerSite p : partnerSiteService.findAll()) { if (p.getOpen()) { p.setOpen(null); sites.add(p); } } return ResponseUtil.success(sites); } }
LinksController { @GetMapping("/links") public Response allForOpen() { List<PartnerSite> sites = new ArrayList<>(); for (PartnerSite p : partnerSiteService.findAll()) { if (p.getOpen()) { p.setOpen(null); sites.add(p); } } return ResponseUtil.success(sites); }  }
LinksController { @GetMapping("/links") public Response allForOpen() { List<PartnerSite> sites = new ArrayList<>(); for (PartnerSite p : partnerSiteService.findAll()) { if (p.getOpen()) { p.setOpen(null); sites.add(p); } } return ResponseUtil.success(sites); }  @PostMapping("/admin/links/create") Response create(@RequestBody LinkReq reqBody); @DeleteMapping("/admin/links/del/{id}") Response del(@PathVariable("id") long id); @PutMapping("/admin/links/update") Response update(@RequestBody LinkReq reqBody); @GetMapping("/links") Response allForOpen(); @GetMapping("/admin/links") Response all(@RequestParam("page") int page,
                        @RequestParam("count") int count); @PostMapping("/apply") Response apply(@RequestParam("name") String name,
                          @RequestParam("url") String url); }
LinksController { @GetMapping("/links") public Response allForOpen() { List<PartnerSite> sites = new ArrayList<>(); for (PartnerSite p : partnerSiteService.findAll()) { if (p.getOpen()) { p.setOpen(null); sites.add(p); } } return ResponseUtil.success(sites); }  @PostMapping("/admin/links/create") Response create(@RequestBody LinkReq reqBody); @DeleteMapping("/admin/links/del/{id}") Response del(@PathVariable("id") long id); @PutMapping("/admin/links/update") Response update(@RequestBody LinkReq reqBody); @GetMapping("/links") Response allForOpen(); @GetMapping("/admin/links") Response all(@RequestParam("page") int page,
                        @RequestParam("count") int count); @PostMapping("/apply") Response apply(@RequestParam("name") String name,
                          @RequestParam("url") String url);  }