@Test public void shouldGetAll() throws Exception { List<ServiceContract> list = new ArrayList<>(); when(service.getAll()).thenReturn(list); ResponseEntity<OpenLmisResponse> response = controller.getAll(); assertThat(list, is(response.getBody().getData().get("contracts"))); }
@RequestMapping(method = GET, value = "list") public ResponseEntity<OpenLmisResponse> getAll(){ return OpenLmisResponse.response(CONTRACTS, service.getAll()); }
ServiceContractController extends BaseController { @RequestMapping(method = GET, value = "list") public ResponseEntity<OpenLmisResponse> getAll(){ return OpenLmisResponse.response(CONTRACTS, service.getAll()); } }
ServiceContractController extends BaseController { @RequestMapping(method = GET, value = "list") public ResponseEntity<OpenLmisResponse> getAll(){ return OpenLmisResponse.response(CONTRACTS, service.getAll()); }  }
ServiceContractController extends BaseController { @RequestMapping(method = GET, value = "list") public ResponseEntity<OpenLmisResponse> getAll(){ return OpenLmisResponse.response(CONTRACTS, service.getAll()); }  @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 = "list") public ResponseEntity<OpenLmisResponse> getAll(){ return OpenLmisResponse.response(CONTRACTS, service.getAll()); }  @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; }