@Test public void shouldGetAllProductGroups() throws Exception { List<ProductGroup> groups = new ArrayList<>(); when(groupService.getAll()).thenReturn(groups); List<ProductGroup> productGroups = controller.getAllGroups(); assertThat(productGroups, is(groups)); }
@RequestMapping(value = "/groups", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") public List<ProductGroup> getAllGroups() { return groupService.getAll(); }
ProductController extends BaseController { @RequestMapping(value = "/groups", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") public List<ProductGroup> getAllGroups() { return groupService.getAll(); } }
ProductController extends BaseController { @RequestMapping(value = "/groups", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") public List<ProductGroup> getAllGroups() { return groupService.getAll(); }  }
ProductController extends BaseController { @RequestMapping(value = "/groups", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") public List<ProductGroup> getAllGroups() { return groupService.getAll(); }  @RequestMapping(value = "/groups", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<ProductGroup> getAllGroups(); @RequestMapping(value = "/forms", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<ProductForm> getAllForms(); @RequestMapping(value = "/dosageUnits", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<DosageUnit> getAllDosageUnits(); @RequestMapping(value = "/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") ProductDTO getById(@PathVariable(value = "id") Long id); @RequestMapping(method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") ResponseEntity<OpenLmisResponse> save(@RequestBody ProductDTO productDTO, HttpServletRequest request); @RequestMapping(value = "/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") ResponseEntity<OpenLmisResponse> update(@RequestBody ProductDTO productDTO, @PathVariable(value = "id") Long id,
                                                 HttpServletRequest request); @RequestMapping(value = "/categories", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<ProductCategory> getAllCategories(); }
ProductController extends BaseController { @RequestMapping(value = "/groups", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") public List<ProductGroup> getAllGroups() { return groupService.getAll(); }  @RequestMapping(value = "/groups", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<ProductGroup> getAllGroups(); @RequestMapping(value = "/forms", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<ProductForm> getAllForms(); @RequestMapping(value = "/dosageUnits", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<DosageUnit> getAllDosageUnits(); @RequestMapping(value = "/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") ProductDTO getById(@PathVariable(value = "id") Long id); @RequestMapping(method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") ResponseEntity<OpenLmisResponse> save(@RequestBody ProductDTO productDTO, HttpServletRequest request); @RequestMapping(value = "/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") ResponseEntity<OpenLmisResponse> update(@RequestBody ProductDTO productDTO, @PathVariable(value = "id") Long id,
                                                 HttpServletRequest request); @RequestMapping(value = "/categories", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PRODUCT')") List<ProductCategory> getAllCategories();  }