@Test public void test_should_continue_escalating_remaining_complaints_when_failure_of_a_single_complaint_happens() { List<ServiceRequest> serviceRequestList = asList( getServiceRequest(null), getServiceRequest(null) ); ServiceResponse serviceResponse = new ServiceResponse(null, serviceRequestList); when(tenantRepository.getAllTenants()).thenReturn(getTenantDetails()); when(complaintRestRepository.getComplaintsEligibleForEscalation("default", 1L)) .thenReturn(serviceResponse); when(userService.getUserByUserName("system", "default")).thenReturn(getUser()); when(workflowService.enrichWorkflowForEscalation(eq(serviceRequestList.get(0)), any())) .thenThrow(new RuntimeException()); escalationService.escalateComplaintForAllTenants(); verify(workflowService).enrichWorkflowForEscalation(eq(serviceRequestList.get(0)), any()); verify(workflowService).enrichWorkflowForEscalation(eq(serviceRequestList.get(1)), any()); }
public void escalateComplaintForAllTenants() { List<Tenant> tenantList = tenantRepository.getAllTenants().getTenant(); if (!CollectionUtils.isEmpty(tenantList)) tenantList.forEach(tenant -> escalateComplaintForTenant(tenant.getCode())); }
EscalationService { public void escalateComplaintForAllTenants() { List<Tenant> tenantList = tenantRepository.getAllTenants().getTenant(); if (!CollectionUtils.isEmpty(tenantList)) tenantList.forEach(tenant -> escalateComplaintForTenant(tenant.getCode())); } }
EscalationService { public void escalateComplaintForAllTenants() { List<Tenant> tenantList = tenantRepository.getAllTenants().getTenant(); if (!CollectionUtils.isEmpty(tenantList)) tenantList.forEach(tenant -> escalateComplaintForTenant(tenant.getCode())); } EscalationService(ComplaintRestRepository complaintRestRepository,
                             WorkflowService workflowService,
                             UserService userService, PositionService positionService,
                             EscalationDateService escalationDateService,
                             ComplaintMessageQueueRepository complaintMessageQueueRepository,
                             TenantRepository tenantRepository); }
EscalationService { public void escalateComplaintForAllTenants() { List<Tenant> tenantList = tenantRepository.getAllTenants().getTenant(); if (!CollectionUtils.isEmpty(tenantList)) tenantList.forEach(tenant -> escalateComplaintForTenant(tenant.getCode())); } EscalationService(ComplaintRestRepository complaintRestRepository,
                             WorkflowService workflowService,
                             UserService userService, PositionService positionService,
                             EscalationDateService escalationDateService,
                             ComplaintMessageQueueRepository complaintMessageQueueRepository,
                             TenantRepository tenantRepository); void escalateComplaintForAllTenants(); }
EscalationService { public void escalateComplaintForAllTenants() { List<Tenant> tenantList = tenantRepository.getAllTenants().getTenant(); if (!CollectionUtils.isEmpty(tenantList)) tenantList.forEach(tenant -> escalateComplaintForTenant(tenant.getCode())); } EscalationService(ComplaintRestRepository complaintRestRepository,
                             WorkflowService workflowService,
                             UserService userService, PositionService positionService,
                             EscalationDateService escalationDateService,
                             ComplaintMessageQueueRepository complaintMessageQueueRepository,
                             TenantRepository tenantRepository); void escalateComplaintForAllTenants();  }