Search in sources :

Example 1 with JsonWrapper

use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.

the class PathCorrelatorTest method unacknowledgedEncodedLabel.

@Test
void unacknowledgedEncodedLabel() {
    Map<String, String> map = new HashMap<>();
    map.put("meep", "meep");
    map.put("encodeLabel", "mawp");
    JsonWrapper wrapper = new JsonWrapper();
    wrapper.putObject("metadata_holder", Lists.newArrayList(map));
    assertThat(PathCorrelator.prepPath("$.mawp", wrapper)).isEmpty();
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) HashMap(java.util.HashMap) Test(org.junit.jupiter.api.Test)

Example 2 with JsonWrapper

use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.

the class ReportingParametersActRoundTripTest method setUp.

@BeforeAll
public static void setUp() {
    Converter converter = new Converter(new PathSource(VALID_QRDA_III));
    JsonWrapper qpp = converter.transform();
    json = qpp.toString();
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with JsonWrapper

use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.

the class IaSectionRoundTripTest method testIaSectionConvertsIaMeasureId.

@Test
void testIaSectionConvertsIaMeasureId() {
    Converter converter = new Converter(new PathSource(file));
    JsonWrapper qpp = converter.transform();
    String iaMeasureId = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[2].measurements[0].measureId", String.class);
    assertWithMessage("Must contain measure id").that(iaMeasureId).isEqualTo("IA_EPA_3");
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Test(org.junit.jupiter.api.Test)

Example 4 with JsonWrapper

use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdMultiRoundTripTest method testRoundTripForQualityMeasureId.

@Test
void testRoundTripForQualityMeasureId() {
    Converter converter = new Converter(new PathSource(JUNK_QRDA3_FILE));
    JsonWrapper qpp = converter.transform();
    String json = qpp.toString();
    List<Map<String, ?>> qualityMeasures = JsonHelper.readJsonAtJsonPath(json, "$.measurementSets[?(@.category=='quality')].measurements[*]", List.class);
    List<Map<String, Integer>> subPopulation = JsonHelper.readJsonAtJsonPath(json, "$.measurementSets[?(@.category=='quality')].measurements[?(@.measureId=='160')].value.strata[*]", List.class);
    String message = "The measureId in the quality measure should still populate given the junk stuff in the measure.";
    assertWithMessage(message).that(qualityMeasures.get(0).get("measureId")).isEqualTo("160");
    assertFirstSubPopulation(subPopulation);
    assertSecondSubPopulation(subPopulation);
    assertThirdSubPopulation(subPopulation);
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 5 with JsonWrapper

use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdRoundTripTest method testRoundTripForQualityMeasureId.

@Test
void testRoundTripForQualityMeasureId() {
    Converter converter = new Converter(new PathSource(JUNK_QRDA3_FILE));
    JsonWrapper qpp = converter.transform();
    List<Map<String, ?>> qualityMeasures = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[?(@.category=='quality')].measurements[*]", List.class);
    assertThat(qualityMeasures).hasSize(1);
    assertWithMessage("The measureId in the quality measure should still populate given the junk stuff in the measure.").that(qualityMeasures.get(0).get("measureId")).isEqualTo("236");
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Aggregations

JsonWrapper (gov.cms.qpp.conversion.encode.JsonWrapper)24 Test (org.junit.jupiter.api.Test)10 Converter (gov.cms.qpp.conversion.Converter)9 PathSource (gov.cms.qpp.conversion.PathSource)8 Node (gov.cms.qpp.conversion.model.Node)3 Map (java.util.Map)3 Path (java.nio.file.Path)2 Test (org.junit.Test)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 JsonPath (com.jayway.jsonpath.JsonPath)1 JsonPathAggregator (gov.cms.qpp.acceptance.helper.JsonPathAggregator)1 JsonPathToXpathHelper (gov.cms.qpp.acceptance.helper.JsonPathToXpathHelper)1 Context (gov.cms.qpp.conversion.Context)1 ConversionReport (gov.cms.qpp.conversion.ConversionReport)1 QrdaDecoderEngine (gov.cms.qpp.conversion.decode.QrdaDecoderEngine)1 XmlInputFileException (gov.cms.qpp.conversion.decode.XmlInputFileException)1 EncodeException (gov.cms.qpp.conversion.encode.EncodeException)1 JsonOutputEncoder (gov.cms.qpp.conversion.encode.JsonOutputEncoder)1