Search in sources :

Example 21 with JsonWrapper

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

the class IaSectionRoundTripTest method testIaSectionConvertsIaCategory.

@Test
void testIaSectionConvertsIaCategory() {
    Converter converter = new Converter(new PathSource(file));
    JsonWrapper qpp = converter.transform();
    String iaCategory = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[2].category", String.class);
    assertWithMessage("Must contain a category").that(iaCategory).isEqualTo("ia");
}
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 22 with JsonWrapper

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

the class IaSectionRoundTripTest method testIaSectionConvertsMeasurePerformed.

@Test
void testIaSectionConvertsMeasurePerformed() {
    Converter converter = new Converter(new PathSource(file));
    JsonWrapper qpp = converter.transform();
    Boolean measurePerformed = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[2].measurements[0].value", Boolean.class);
    assertWithMessage("Must contain a measure performed").that(measurePerformed).isTrue();
}
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 23 with JsonWrapper

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

the class JsonPathToXpathCoverageTest method testCoverage.

@ParameterizedTest
@MethodSource("paths")
void testCoverage(Path path) throws IOException {
    JsonWrapper metaWrapper = new JsonWrapper(false);
    helper = new JsonPathToXpathHelper(path, metaWrapper, false);
    JsonWrapper wrapper = new JsonWrapper(metaWrapper, true);
    JsonNode root = om.readTree(wrapper.toString());
    JsonPathAggregator agg = new JsonPathAggregator(root);
    agg.getJsonPaths().forEach((key, value) -> helper.executeAttributeTest(key, value));
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) JsonPathToXpathHelper(gov.cms.qpp.acceptance.helper.JsonPathToXpathHelper) JsonNode(com.fasterxml.jackson.databind.JsonNode) JsonPathAggregator(gov.cms.qpp.acceptance.helper.JsonPathAggregator) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 24 with JsonWrapper

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

the class AciMeasurePerformedRoundTripTest method testGarbage.

@Test
void testGarbage() {
    Converter converter = new Converter(new PathSource(JUNK_QRDA3_FILE));
    JsonWrapper qpp = converter.transform();
    List<Map<String, ?>> aciMeasures = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[?(@.category=='aci')].measurements[?(@.measureId=='TEST_MEASURE_ID')]", List.class);
    assertThat(aciMeasures).hasSize(1);
    assertThat((aciMeasures.get(0).get("measureId"))).isEqualTo("TEST_MEASURE_ID");
}
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