@Test public void test_should_check_that_complaint_gets_escalated() { List<ServiceRequest> serviceRequestList = asList( getServiceRequest(null), getServiceRequest(null) ); ServiceResponse serviceResponse = new ServiceResponse(null, serviceRequestList); when(tenantRepository.getAllTenants()).thenReturn(getTenantDetails()); when(userService.getUserByUserName("system", "default")).thenReturn(getUser()); when(complaintRestRepository.getComplaintsEligibleForEscalation("default", 1L)).thenReturn(serviceResponse); whenInvokedUpdateAssignee(serviceRequestList.get(0), "3"); whenInvokedUpdateAssignee(serviceRequestList.get(1), "3"); escalationService.escalateComplaintForAllTenants(); verify(complaintMessageQueueRepository, times(2)).save(any()); assertTrue(serviceRequestList.get(0).isEscalated()); assertTrue(serviceRequestList.get(1).isEscalated()); }
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();  }