@Test public void test_for_get_status_for_keyword(){ when(keywordStatusMappingJpaRepository .findByKeywordAndTenantId("Complaint","default")) .thenReturn(getKeyWordStatusMappingEntities()); List<KeywordStatusMapping> statusList = keywordStatusMappingJpaRepository.findByKeywordAndTenantId( "Complaint","default"); when(complaintStatusJpaRepository.findByCodeInAndTenantId(asList("REGISTERED","CLOSED"),"default")) .thenReturn(getServiceStatusList()); List<org.egov.workflow.domain.model.ComplaintStatus> domainStatuses = keywordStatusMappingRepository .getAllStatusForKeyword("Complaint","default"); assertEquals(domainStatuses.size(),2); assertEquals(domainStatuses.get(0).getCode(), "0001"); }
public List<org.egov.workflow.domain.model.ComplaintStatus> getAllStatusForKeyword(String keyWord, String tenantId){ List<String> statusCodes = keywordStatusMappingJpaRepository.findByKeywordAndTenantId(keyWord,tenantId) .stream() .map(status -> status.getId().getCode()) .collect(Collectors.toList()); return complaintStatusJpaRepository.findByCodeInAndTenantId(statusCodes,tenantId) .stream() .map(ComplaintStatus::toDomain) .collect(Collectors.toList()); }
KeywordStatusMappingRepository { public List<org.egov.workflow.domain.model.ComplaintStatus> getAllStatusForKeyword(String keyWord, String tenantId){ List<String> statusCodes = keywordStatusMappingJpaRepository.findByKeywordAndTenantId(keyWord,tenantId) .stream() .map(status -> status.getId().getCode()) .collect(Collectors.toList()); return complaintStatusJpaRepository.findByCodeInAndTenantId(statusCodes,tenantId) .stream() .map(ComplaintStatus::toDomain) .collect(Collectors.toList()); } }
KeywordStatusMappingRepository { public List<org.egov.workflow.domain.model.ComplaintStatus> getAllStatusForKeyword(String keyWord, String tenantId){ List<String> statusCodes = keywordStatusMappingJpaRepository.findByKeywordAndTenantId(keyWord,tenantId) .stream() .map(status -> status.getId().getCode()) .collect(Collectors.toList()); return complaintStatusJpaRepository.findByCodeInAndTenantId(statusCodes,tenantId) .stream() .map(ComplaintStatus::toDomain) .collect(Collectors.toList()); } KeywordStatusMappingRepository(KeywordStatusMappingJpaRepository keywordStatusMappingJpaRepository,
                                          ComplaintStatusJpaRepository complaintStatusJpaRepository); }
KeywordStatusMappingRepository { public List<org.egov.workflow.domain.model.ComplaintStatus> getAllStatusForKeyword(String keyWord, String tenantId){ List<String> statusCodes = keywordStatusMappingJpaRepository.findByKeywordAndTenantId(keyWord,tenantId) .stream() .map(status -> status.getId().getCode()) .collect(Collectors.toList()); return complaintStatusJpaRepository.findByCodeInAndTenantId(statusCodes,tenantId) .stream() .map(ComplaintStatus::toDomain) .collect(Collectors.toList()); } KeywordStatusMappingRepository(KeywordStatusMappingJpaRepository keywordStatusMappingJpaRepository,
                                          ComplaintStatusJpaRepository complaintStatusJpaRepository); List<org.egov.workflow.domain.model.ComplaintStatus> getAllStatusForKeyword(String keyWord, String tenantId); }
KeywordStatusMappingRepository { public List<org.egov.workflow.domain.model.ComplaintStatus> getAllStatusForKeyword(String keyWord, String tenantId){ List<String> statusCodes = keywordStatusMappingJpaRepository.findByKeywordAndTenantId(keyWord,tenantId) .stream() .map(status -> status.getId().getCode()) .collect(Collectors.toList()); return complaintStatusJpaRepository.findByCodeInAndTenantId(statusCodes,tenantId) .stream() .map(ComplaintStatus::toDomain) .collect(Collectors.toList()); } KeywordStatusMappingRepository(KeywordStatusMappingJpaRepository keywordStatusMappingJpaRepository,
                                          ComplaintStatusJpaRepository complaintStatusJpaRepository); List<org.egov.workflow.domain.model.ComplaintStatus> getAllStatusForKeyword(String keyWord, String tenantId);  }