@Test public void shouldSave() throws Exception { VaccineServiceConfigDTO dto = new VaccineServiceConfigDTO(); dto.setProtocols(new ArrayList<ProductDoseDTO>()); doNothing().when(service).save(dto.getProtocols()); ResponseEntity<OpenLmisResponse> response = controller.save(dto); verify(service).save(anyList()); assertThat(dto, is(response.getBody().getData().get("protocol"))); }
@RequestMapping(value = "save", headers = ACCEPT_JSON, method = RequestMethod.PUT) public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineServiceConfigDTO config) { service.save(config.getProtocols()); return OpenLmisResponse.response(PROTOCOL, config); }
ProductDoseController extends BaseController { @RequestMapping(value = "save", headers = ACCEPT_JSON, method = RequestMethod.PUT) public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineServiceConfigDTO config) { service.save(config.getProtocols()); return OpenLmisResponse.response(PROTOCOL, config); } }
ProductDoseController extends BaseController { @RequestMapping(value = "save", headers = ACCEPT_JSON, method = RequestMethod.PUT) public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineServiceConfigDTO config) { service.save(config.getProtocols()); return OpenLmisResponse.response(PROTOCOL, config); }  }
ProductDoseController extends BaseController { @RequestMapping(value = "save", headers = ACCEPT_JSON, method = RequestMethod.PUT) public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineServiceConfigDTO config) { service.save(config.getProtocols()); return OpenLmisResponse.response(PROTOCOL, config); }  @RequestMapping(value = "get/{programId}") ResponseEntity<OpenLmisResponse> getProgramProtocol(@PathVariable Long programId); @RequestMapping(value = "save", headers = ACCEPT_JSON, method = RequestMethod.PUT) ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineServiceConfigDTO config); }
ProductDoseController extends BaseController { @RequestMapping(value = "save", headers = ACCEPT_JSON, method = RequestMethod.PUT) public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineServiceConfigDTO config) { service.save(config.getProtocols()); return OpenLmisResponse.response(PROTOCOL, config); }  @RequestMapping(value = "get/{programId}") ResponseEntity<OpenLmisResponse> getProgramProtocol(@PathVariable Long programId); @RequestMapping(value = "save", headers = ACCEPT_JSON, method = RequestMethod.PUT) ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineServiceConfigDTO config); static final String PROTOCOL; }