@Test public void shouldSave() throws Exception { ServiceContract contract = new ServiceContract(); doNothing().when(service).save(contract); ResponseEntity<OpenLmisResponse> response = controller.save(contract); assertThat(response.getBody().getSuccessMsg(), is(notNullValue())); assertThat(contract, is(response.getBody().getData().get("contract"))); }
@RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceContract contract){ service.save(contract); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.contract.saved"); response.getBody().addData(CONTRACT, contract); return response; }
ServiceContractController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceContract contract){ service.save(contract); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.contract.saved"); response.getBody().addData(CONTRACT, contract); return response; } }
ServiceContractController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceContract contract){ service.save(contract); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.contract.saved"); response.getBody().addData(CONTRACT, contract); return response; }  }
ServiceContractController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceContract contract){ service.save(contract); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.contract.saved"); response.getBody().addData(CONTRACT, contract); return response; }  @RequestMapping(method = GET, value = "list") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(method = GET, value = "id") ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id); @RequestMapping(method = GET, value = "for-facility") ResponseEntity<OpenLmisResponse> getByFacilityId( @RequestParam("id") Long id); @RequestMapping(method = GET, value = "for-vendor") ResponseEntity<OpenLmisResponse> getByVendorId( @RequestParam("id") Long id); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceContract contract); }
ServiceContractController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceContract contract){ service.save(contract); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.contract.saved"); response.getBody().addData(CONTRACT, contract); return response; }  @RequestMapping(method = GET, value = "list") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(method = GET, value = "id") ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id); @RequestMapping(method = GET, value = "for-facility") ResponseEntity<OpenLmisResponse> getByFacilityId( @RequestParam("id") Long id); @RequestMapping(method = GET, value = "for-vendor") ResponseEntity<OpenLmisResponse> getByVendorId( @RequestParam("id") Long id); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceContract contract); static final String CONTRACT; static final String CONTRACTS; }