@Test public void testFindEntityEmpty() { Mockito.when(groupListHelper.getEntity("", "", true)).thenReturn(null); JsonEntityBean entityBean = entitiesRESTController.findEntity(req, res, "", ""); Assert.assertNull(entityBean); }
@PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) public JsonEntityBean findEntity( HttpServletRequest request, HttpServletResponse response, @PathVariable("entityType") String entityType, @PathVariable("entityId") String entityId) { final JsonEntityBean result = groupListHelper.getEntity(entityType, entityId, true); return result; }
EntitiesRESTController { @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) public JsonEntityBean findEntity( HttpServletRequest request, HttpServletResponse response, @PathVariable("entityType") String entityType, @PathVariable("entityId") String entityId) { final JsonEntityBean result = groupListHelper.getEntity(entityType, entityId, true); return result; } }
EntitiesRESTController { @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) public JsonEntityBean findEntity( HttpServletRequest request, HttpServletResponse response, @PathVariable("entityType") String entityType, @PathVariable("entityId") String entityId) { final JsonEntityBean result = groupListHelper.getEntity(entityType, entityId, true); return result; }  }
EntitiesRESTController { @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) public JsonEntityBean findEntity( HttpServletRequest request, HttpServletResponse response, @PathVariable("entityType") String entityType, @PathVariable("entityId") String entityId) { final JsonEntityBean result = groupListHelper.getEntity(entityType, entityId, true); return result; }  @Autowired void setGroupListHelper(IGroupListHelper groupListHelper); @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) JsonEntityBean findEntity(
            HttpServletRequest request,
            HttpServletResponse response,
            @PathVariable("entityType") String entityType,
            @PathVariable("entityId") String entityId); @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) Set<JsonEntityBean> doSearch(
            HttpServletRequest request,
            HttpServletResponse response,
            @RequestParam("q") String query,
            @RequestParam("entityType[]") List<String> entityTypes); }
EntitiesRESTController { @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) public JsonEntityBean findEntity( HttpServletRequest request, HttpServletResponse response, @PathVariable("entityType") String entityType, @PathVariable("entityId") String entityId) { final JsonEntityBean result = groupListHelper.getEntity(entityType, entityId, true); return result; }  @Autowired void setGroupListHelper(IGroupListHelper groupListHelper); @PostAuthorize("hasPermission(returnObject, 'VIEW')") @RequestMapping(value = "/entities/{entityType}/{entityId}.json", method = RequestMethod.GET) JsonEntityBean findEntity(
            HttpServletRequest request,
            HttpServletResponse response,
            @PathVariable("entityType") String entityType,
            @PathVariable("entityId") String entityId); @PostFilter("hasPermission(filterObject, 'VIEW')") @RequestMapping(value = "/entities.json", method = RequestMethod.GET) Set<JsonEntityBean> doSearch(
            HttpServletRequest request,
            HttpServletResponse response,
            @RequestParam("q") String query,
            @RequestParam("entityType[]") List<String> entityTypes);  }