@Test public void test_should_update_workflow_for_escalated_complaints() throws Exception { ServiceRequest expectedServiceRequest = ServiceRequest.builder() .complaintTypeCode("BRKBN") .build(); WorkflowRequest escalationRequest = WorkflowRequest.builder() .businessKey(COMPLAINT) .action(UPDATE) .status(REGISTERED) .type(COMPLAINT) .build(); WorkflowResponse expectedWorkflowResponse = WorkflowResponse.builder() .assignee("1") .values(getExpectedValues()) .build(); when(workflowRepository.update(any())).thenReturn(expectedWorkflowResponse); ServiceRequest request = workflowService.enrichWorkflowForEscalation(getServiceRequest(),getRequestInfo()); assertEquals(request.getComplaintTypeCode(),expectedServiceRequest.getComplaintTypeCode()); assertEquals(IN_PROGRESS,expectedWorkflowResponse.getValueForKey(COMPLAINT_STATUS)); }
public ServiceRequest enrichWorkflowForEscalation(ServiceRequest serviceRequest, RequestInfo requestInfo) { serviceRequest.setPreviousAssignee(serviceRequest.getPositionId()); WorkflowRequest escalationRequest = serviceRequest.getWorkFlowRequestForEscalation(requestInfo); WorkflowResponse workflowResponse = workflowRepository.update(escalationRequest); if (workflowResponse != null) serviceRequest.update(workflowResponse); return serviceRequest; }
WorkflowService { public ServiceRequest enrichWorkflowForEscalation(ServiceRequest serviceRequest, RequestInfo requestInfo) { serviceRequest.setPreviousAssignee(serviceRequest.getPositionId()); WorkflowRequest escalationRequest = serviceRequest.getWorkFlowRequestForEscalation(requestInfo); WorkflowResponse workflowResponse = workflowRepository.update(escalationRequest); if (workflowResponse != null) serviceRequest.update(workflowResponse); return serviceRequest; } }
WorkflowService { public ServiceRequest enrichWorkflowForEscalation(ServiceRequest serviceRequest, RequestInfo requestInfo) { serviceRequest.setPreviousAssignee(serviceRequest.getPositionId()); WorkflowRequest escalationRequest = serviceRequest.getWorkFlowRequestForEscalation(requestInfo); WorkflowResponse workflowResponse = workflowRepository.update(escalationRequest); if (workflowResponse != null) serviceRequest.update(workflowResponse); return serviceRequest; } @Autowired  WorkflowService(WorkflowRepository workflowRepository, ComplaintRestRepository complaintRestRepository); }
WorkflowService { public ServiceRequest enrichWorkflowForEscalation(ServiceRequest serviceRequest, RequestInfo requestInfo) { serviceRequest.setPreviousAssignee(serviceRequest.getPositionId()); WorkflowRequest escalationRequest = serviceRequest.getWorkFlowRequestForEscalation(requestInfo); WorkflowResponse workflowResponse = workflowRepository.update(escalationRequest); if (workflowResponse != null) serviceRequest.update(workflowResponse); return serviceRequest; } @Autowired  WorkflowService(WorkflowRepository workflowRepository, ComplaintRestRepository complaintRestRepository); ServiceRequest enrichWorkflowForEscalation(ServiceRequest serviceRequest, RequestInfo requestInfo); }
WorkflowService { public ServiceRequest enrichWorkflowForEscalation(ServiceRequest serviceRequest, RequestInfo requestInfo) { serviceRequest.setPreviousAssignee(serviceRequest.getPositionId()); WorkflowRequest escalationRequest = serviceRequest.getWorkFlowRequestForEscalation(requestInfo); WorkflowResponse workflowResponse = workflowRepository.update(escalationRequest); if (workflowResponse != null) serviceRequest.update(workflowResponse); return serviceRequest; } @Autowired  WorkflowService(WorkflowRepository workflowRepository, ComplaintRestRepository complaintRestRepository); ServiceRequest enrichWorkflowForEscalation(ServiceRequest serviceRequest, RequestInfo requestInfo);  }