@Test public void shouldGetById() throws Exception { ServiceContract contract = new ServiceContract(); when(service.getById(5L)).thenReturn(contract); ResponseEntity<OpenLmisResponse> response = controller.getById(5L); assertThat(contract, is(response.getBody().getData().get("contract"))); }
@RequestMapping(method = GET, value = "id") public ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id){ ServiceContract contract = service.getById(id); contract.setId(id); return OpenLmisResponse.response(CONTRACT, contract); }
ServiceContractController extends BaseController { @RequestMapping(method = GET, value = "id") public ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id){ ServiceContract contract = service.getById(id); contract.setId(id); return OpenLmisResponse.response(CONTRACT, contract); } }
ServiceContractController extends BaseController { @RequestMapping(method = GET, value = "id") public ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id){ ServiceContract contract = service.getById(id); contract.setId(id); return OpenLmisResponse.response(CONTRACT, contract); }  }
ServiceContractController extends BaseController { @RequestMapping(method = GET, value = "id") public ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id){ ServiceContract contract = service.getById(id); contract.setId(id); return OpenLmisResponse.response(CONTRACT, contract); }  @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(method = GET, value = "id") public ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id){ ServiceContract contract = service.getById(id); contract.setId(id); return OpenLmisResponse.response(CONTRACT, contract); }  @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; }