@Test(expected = InvalidComplaintStatusException.class) public void test_find_next_statuses_should_throw_exception_when_currentstatus_is_not_found() { final String CURRENT_STATUS_NAME = "REJECTED"; List<Long> listOfRoles = asList(1L, 2L); when(complaintStatusRepository.findByName(CURRENT_STATUS_NAME)).thenReturn(null); ComplaintStatusSearchCriteria complaintStatusSearchCriteria = new ComplaintStatusSearchCriteria(CURRENT_STATUS_NAME, listOfRoles, "default"); List<ComplaintStatus> nextStatuses = complaintStatusService.getNextStatuses(complaintStatusSearchCriteria); assertThat(nextStatuses.size()).isEqualTo(0); }
public List<ComplaintStatus> getNextStatuses(ComplaintStatusSearchCriteria complaintStatusSearchCriteria) { complaintStatusSearchCriteria.validate(); ComplaintStatus currentStatus = complaintStatusRepository.findByCodeAndTenantId( complaintStatusSearchCriteria.getComplaintStatusCode(), complaintStatusSearchCriteria.getTenantId()); if (currentStatus == null) { throw new InvalidComplaintStatusException(); } return complaintStatusMappingRepository .getNextStatuses(currentStatus.getId(), complaintStatusSearchCriteria.getRoles(), complaintStatusSearchCriteria.getTenantId()); }
ComplaintStatusService { public List<ComplaintStatus> getNextStatuses(ComplaintStatusSearchCriteria complaintStatusSearchCriteria) { complaintStatusSearchCriteria.validate(); ComplaintStatus currentStatus = complaintStatusRepository.findByCodeAndTenantId( complaintStatusSearchCriteria.getComplaintStatusCode(), complaintStatusSearchCriteria.getTenantId()); if (currentStatus == null) { throw new InvalidComplaintStatusException(); } return complaintStatusMappingRepository .getNextStatuses(currentStatus.getId(), complaintStatusSearchCriteria.getRoles(), complaintStatusSearchCriteria.getTenantId()); } }
ComplaintStatusService { public List<ComplaintStatus> getNextStatuses(ComplaintStatusSearchCriteria complaintStatusSearchCriteria) { complaintStatusSearchCriteria.validate(); ComplaintStatus currentStatus = complaintStatusRepository.findByCodeAndTenantId( complaintStatusSearchCriteria.getComplaintStatusCode(), complaintStatusSearchCriteria.getTenantId()); if (currentStatus == null) { throw new InvalidComplaintStatusException(); } return complaintStatusMappingRepository .getNextStatuses(currentStatus.getId(), complaintStatusSearchCriteria.getRoles(), complaintStatusSearchCriteria.getTenantId()); } ComplaintStatusService(ComplaintStatusRepository complaintStatusRepository,
                                  ComplaintStatusMappingRepository complaintStatusMappingRepository); }
ComplaintStatusService { public List<ComplaintStatus> getNextStatuses(ComplaintStatusSearchCriteria complaintStatusSearchCriteria) { complaintStatusSearchCriteria.validate(); ComplaintStatus currentStatus = complaintStatusRepository.findByCodeAndTenantId( complaintStatusSearchCriteria.getComplaintStatusCode(), complaintStatusSearchCriteria.getTenantId()); if (currentStatus == null) { throw new InvalidComplaintStatusException(); } return complaintStatusMappingRepository .getNextStatuses(currentStatus.getId(), complaintStatusSearchCriteria.getRoles(), complaintStatusSearchCriteria.getTenantId()); } ComplaintStatusService(ComplaintStatusRepository complaintStatusRepository,
                                  ComplaintStatusMappingRepository complaintStatusMappingRepository); List<ComplaintStatus> findAll(); List<ComplaintStatus> getNextStatuses(ComplaintStatusSearchCriteria complaintStatusSearchCriteria); }
ComplaintStatusService { public List<ComplaintStatus> getNextStatuses(ComplaintStatusSearchCriteria complaintStatusSearchCriteria) { complaintStatusSearchCriteria.validate(); ComplaintStatus currentStatus = complaintStatusRepository.findByCodeAndTenantId( complaintStatusSearchCriteria.getComplaintStatusCode(), complaintStatusSearchCriteria.getTenantId()); if (currentStatus == null) { throw new InvalidComplaintStatusException(); } return complaintStatusMappingRepository .getNextStatuses(currentStatus.getId(), complaintStatusSearchCriteria.getRoles(), complaintStatusSearchCriteria.getTenantId()); } ComplaintStatusService(ComplaintStatusRepository complaintStatusRepository,
                                  ComplaintStatusMappingRepository complaintStatusMappingRepository); List<ComplaintStatus> findAll(); List<ComplaintStatus> getNextStatuses(ComplaintStatusSearchCriteria complaintStatusSearchCriteria);  }