@Test public void shouldRemoveSuccessfully() throws Exception { doNothing().when(service).removeVendor(2L); ResponseEntity<OpenLmisResponse> response = controller.remove(2L); assertThat(response.getBody().getSuccessMsg(), is(notNullValue())); }
@RequestMapping(value = "delete/{id}", method = GET, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "id") Long vendorId) { try { service.removeVendor(vendorId); } catch (DataIntegrityViolationException ex) { return OpenLmisResponse.error("error.equipment.vendor.in.use", HttpStatus.BAD_REQUEST); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return success("message.equipment.vendor.removed.successfully"); }
VendorController extends BaseController { @RequestMapping(value = "delete/{id}", method = GET, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "id") Long vendorId) { try { service.removeVendor(vendorId); } catch (DataIntegrityViolationException ex) { return OpenLmisResponse.error("error.equipment.vendor.in.use", HttpStatus.BAD_REQUEST); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return success("message.equipment.vendor.removed.successfully"); } }
VendorController extends BaseController { @RequestMapping(value = "delete/{id}", method = GET, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "id") Long vendorId) { try { service.removeVendor(vendorId); } catch (DataIntegrityViolationException ex) { return OpenLmisResponse.error("error.equipment.vendor.in.use", HttpStatus.BAD_REQUEST); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return success("message.equipment.vendor.removed.successfully"); }  }
VendorController extends BaseController { @RequestMapping(value = "delete/{id}", method = GET, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "id") Long vendorId) { try { service.removeVendor(vendorId); } catch (DataIntegrityViolationException ex) { return OpenLmisResponse.error("error.equipment.vendor.in.use", HttpStatus.BAD_REQUEST); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return success("message.equipment.vendor.removed.successfully"); }  @RequestMapping(method = GET, value = "list") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(method = GET, value = "id") ResponseEntity<OpenLmisResponse> getById(@RequestParam("id") Long id); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> save(@RequestBody Vendor vendor); @RequestMapping(value = "delete/{id}", method = GET, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "id") Long vendorId); }
VendorController extends BaseController { @RequestMapping(value = "delete/{id}", method = GET, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "id") Long vendorId) { try { service.removeVendor(vendorId); } catch (DataIntegrityViolationException ex) { return OpenLmisResponse.error("error.equipment.vendor.in.use", HttpStatus.BAD_REQUEST); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return success("message.equipment.vendor.removed.successfully"); }  @RequestMapping(method = GET, value = "list") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(method = GET, value = "id") ResponseEntity<OpenLmisResponse> getById(@RequestParam("id") Long id); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> save(@RequestBody Vendor vendor); @RequestMapping(value = "delete/{id}", method = GET, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "id") Long vendorId); static final String VENDOR; }