@Test public void shouldGetById() throws Exception { EquipmentEnergyType type = new EquipmentEnergyType(); type.setName("Test"); when(service.getById(1L)).thenReturn(type); controller.getById(1L); verify(service).getById(1L); }
@RequestMapping(method = GET, value = "{id}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getById(@PathVariable(value="id") Long id){ return OpenLmisResponse.response("energyType",service.getById(id)); }
EquipmentEnergyTypeController extends BaseController { @RequestMapping(method = GET, value = "{id}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getById(@PathVariable(value="id") Long id){ return OpenLmisResponse.response("energyType",service.getById(id)); } }
EquipmentEnergyTypeController extends BaseController { @RequestMapping(method = GET, value = "{id}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getById(@PathVariable(value="id") Long id){ return OpenLmisResponse.response("energyType",service.getById(id)); }  }
EquipmentEnergyTypeController extends BaseController { @RequestMapping(method = GET, value = "{id}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getById(@PathVariable(value="id") Long id){ return OpenLmisResponse.response("energyType",service.getById(id)); }  @RequestMapping(value="list",method= GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')" + " or @permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_INVENTORY')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> save(@RequestBody EquipmentEnergyType energyType); @RequestMapping(method = GET, value = "{id}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getById(@PathVariable(value="id") Long id); }
EquipmentEnergyTypeController extends BaseController { @RequestMapping(method = GET, value = "{id}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getById(@PathVariable(value="id") Long id){ return OpenLmisResponse.response("energyType",service.getById(id)); }  @RequestMapping(value="list",method= GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')" + " or @permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_INVENTORY')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> save(@RequestBody EquipmentEnergyType energyType); @RequestMapping(method = GET, value = "{id}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getById(@PathVariable(value="id") Long id);  }