Skip to content

Commit

Permalink
MAT-5567 more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
adongare committed May 26, 2023
1 parent 7a9b32e commit ef91c41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import gov.cms.mat.cql_elm_translation.utils.cql.parsing.model.CQLValueSet;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections4.MapUtils;
import org.cqframework.cql.cql2elm.CqlTranslator;
Expand Down Expand Up @@ -56,10 +57,16 @@ public DataCriteria parseDataCriteriaFromCql(String cql, String accessToken) {
}

public List<SourceDataCriteria> getSourceDataCriteria(String cql, String accessToken) {
if (StringUtils.isBlank(cql)) {
log.info("Data criteria not found as cql is blank");
return Collections.emptyList();
}

DataCriteria dataCriteria = parseDataCriteriaFromCql(cql, accessToken);
Map<CQLValueSet, Set<String>> criteriaWithValueSet =
dataCriteria.getDataCriteriaWithValueSets();
if (MapUtils.isEmpty(criteriaWithValueSet)) {
log.info("Data criteria not found for given cql");
return Collections.emptyList();
}
// data criteria from value sets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ void testGetSourceDataCriteriaWhenNoSourceCriteriaFound() {
List<SourceDataCriteria> sourceDataCriteria =
dataCriteriaService.getSourceDataCriteria(cql, token);

// source data criteria for value set
assertThat(sourceDataCriteria.size(), is(equalTo(0)));
}

@Test
void testGetSourceDataCriteriaWhenNoCqlProvided() {
List<SourceDataCriteria> sourceDataCriteria =
dataCriteriaService.getSourceDataCriteria("", token);
assertThat(sourceDataCriteria.size(), is(equalTo(0)));
}
}

0 comments on commit ef91c41

Please sign in to comment.