@Test public void shouldGetRegimenTemplate() throws Exception { List<RegimenColumn> expectedRegimens = new ArrayList<>(); Long programId = 1l; RegimenTemplate template = new RegimenTemplate(programId, expectedRegimens); when(service.getRegimenTemplateOrMasterTemplate(programId)).thenReturn(template); ResponseEntity<OpenLmisResponse> response = controller.getProgramOrMasterRegimenTemplate(programId); verify(service).getRegimenTemplateOrMasterTemplate(programId); assertThat((RegimenTemplate) response.getBody().getData().get("template"), is(template)); }
@RequestMapping(value = "/programId/{programId}/configureRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_REGIMEN_TEMPLATE, VIEW_REQUISITION')") public ResponseEntity<OpenLmisResponse> getProgramOrMasterRegimenTemplate(@PathVariable Long programId) { return OpenLmisResponse.response("template", service.getRegimenTemplateOrMasterTemplate(programId)); }
RegimenTemplateController extends BaseController { @RequestMapping(value = "/programId/{programId}/configureRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_REGIMEN_TEMPLATE, VIEW_REQUISITION')") public ResponseEntity<OpenLmisResponse> getProgramOrMasterRegimenTemplate(@PathVariable Long programId) { return OpenLmisResponse.response("template", service.getRegimenTemplateOrMasterTemplate(programId)); } }
RegimenTemplateController extends BaseController { @RequestMapping(value = "/programId/{programId}/configureRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_REGIMEN_TEMPLATE, VIEW_REQUISITION')") public ResponseEntity<OpenLmisResponse> getProgramOrMasterRegimenTemplate(@PathVariable Long programId) { return OpenLmisResponse.response("template", service.getRegimenTemplateOrMasterTemplate(programId)); }  }
RegimenTemplateController extends BaseController { @RequestMapping(value = "/programId/{programId}/configureRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_REGIMEN_TEMPLATE, VIEW_REQUISITION')") public ResponseEntity<OpenLmisResponse> getProgramOrMasterRegimenTemplate(@PathVariable Long programId) { return OpenLmisResponse.response("template", service.getRegimenTemplateOrMasterTemplate(programId)); }  @RequestMapping(value = "/programId/{programId}/configureRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_REGIMEN_TEMPLATE, VIEW_REQUISITION')") ResponseEntity<OpenLmisResponse> getProgramOrMasterRegimenTemplate(@PathVariable Long programId); @RequestMapping(value = "/programId/{programId}/programRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'VIEW_REQUISITION')") ResponseEntity<OpenLmisResponse> getProgramRegimenTemplate(@PathVariable Long programId); }
RegimenTemplateController extends BaseController { @RequestMapping(value = "/programId/{programId}/configureRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_REGIMEN_TEMPLATE, VIEW_REQUISITION')") public ResponseEntity<OpenLmisResponse> getProgramOrMasterRegimenTemplate(@PathVariable Long programId) { return OpenLmisResponse.response("template", service.getRegimenTemplateOrMasterTemplate(programId)); }  @RequestMapping(value = "/programId/{programId}/configureRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_REGIMEN_TEMPLATE, VIEW_REQUISITION')") ResponseEntity<OpenLmisResponse> getProgramOrMasterRegimenTemplate(@PathVariable Long programId); @RequestMapping(value = "/programId/{programId}/programRegimenTemplate", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'VIEW_REQUISITION')") ResponseEntity<OpenLmisResponse> getProgramRegimenTemplate(@PathVariable Long programId);  }