@Test public void shouldReturnResponseWithListOfProgramsWithProducts() { List<ProgramWithProducts> programsWithProducts = new ArrayList(); programsWithProducts.add(new ProgramWithProductsBuilder().build()); when(restProgramsService.getAllProgramsWithProductsByFacilityCode("F10")).thenReturn(programsWithProducts); ResponseEntity<RestResponse> response = restProgramsController.getProgramWithProductsByFacility("F10"); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(programsWithProducts, response.getBody().getData().get("programsWithProducts")); }
@RequestMapping(value = "/rest-api/programs-with-products", method = GET, headers = ACCEPT_JSON) public ResponseEntity<RestResponse> getProgramWithProductsByFacility(@RequestParam String facilityCode) { try { List<ProgramWithProducts> programsWithProducts = programService.getAllProgramsWithProductsByFacilityCode(facilityCode); return response("programsWithProducts", programsWithProducts); } catch (DataException e) { return error(e.getOpenLmisMessage(), BAD_REQUEST); } }
RestProgramsController extends BaseController { @RequestMapping(value = "/rest-api/programs-with-products", method = GET, headers = ACCEPT_JSON) public ResponseEntity<RestResponse> getProgramWithProductsByFacility(@RequestParam String facilityCode) { try { List<ProgramWithProducts> programsWithProducts = programService.getAllProgramsWithProductsByFacilityCode(facilityCode); return response("programsWithProducts", programsWithProducts); } catch (DataException e) { return error(e.getOpenLmisMessage(), BAD_REQUEST); } } }
RestProgramsController extends BaseController { @RequestMapping(value = "/rest-api/programs-with-products", method = GET, headers = ACCEPT_JSON) public ResponseEntity<RestResponse> getProgramWithProductsByFacility(@RequestParam String facilityCode) { try { List<ProgramWithProducts> programsWithProducts = programService.getAllProgramsWithProductsByFacilityCode(facilityCode); return response("programsWithProducts", programsWithProducts); } catch (DataException e) { return error(e.getOpenLmisMessage(), BAD_REQUEST); } }  }
RestProgramsController extends BaseController { @RequestMapping(value = "/rest-api/programs-with-products", method = GET, headers = ACCEPT_JSON) public ResponseEntity<RestResponse> getProgramWithProductsByFacility(@RequestParam String facilityCode) { try { List<ProgramWithProducts> programsWithProducts = programService.getAllProgramsWithProductsByFacilityCode(facilityCode); return response("programsWithProducts", programsWithProducts); } catch (DataException e) { return error(e.getOpenLmisMessage(), BAD_REQUEST); } }  @RequestMapping(value = "/rest-api/programs-with-products", method = GET, headers = ACCEPT_JSON) ResponseEntity<RestResponse> getProgramWithProductsByFacility(@RequestParam String facilityCode); }
RestProgramsController extends BaseController { @RequestMapping(value = "/rest-api/programs-with-products", method = GET, headers = ACCEPT_JSON) public ResponseEntity<RestResponse> getProgramWithProductsByFacility(@RequestParam String facilityCode) { try { List<ProgramWithProducts> programsWithProducts = programService.getAllProgramsWithProductsByFacilityCode(facilityCode); return response("programsWithProducts", programsWithProducts); } catch (DataException e) { return error(e.getOpenLmisMessage(), BAD_REQUEST); } }  @RequestMapping(value = "/rest-api/programs-with-products", method = GET, headers = ACCEPT_JSON) ResponseEntity<RestResponse> getProgramWithProductsByFacility(@RequestParam String facilityCode);  }