Search in sources :

Example 41 with Context

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

the class QualityMeasureIdEncoderTest method setUp.

@BeforeEach
void setUp() {
    qualityMeasureId = new Node(TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V2);
    qualityMeasureId.putValue("measureId", "40280381-51f0-825b-0152-22b98cff181a");
    aggregateCountNode = new Node(TemplateId.ACI_AGGREGATE_COUNT);
    aggregateCountNode.putValue("aggregateCount", "600");
    Node paymentNode = new Node(TemplateId.PAYER_SUPPLEMENTAL_DATA_ELEMENT_CMS_V2);
    paymentNode.putValue("place", "holder");
    populationNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    populationNode.putValue(type, SubPopulationLabel.IPOP.name());
    populationNode.addChildNode(aggregateCountNode);
    denomExclusionNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    denomExclusionNode.putValue(type, SubPopulationLabel.DENEX.name());
    denomExclusionNode.addChildNode(aggregateCountNode);
    numeratorNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    numeratorNode.putValue(type, SubPopulationLabel.NUMER.name());
    numeratorNode.addChildNode(aggregateCountNode);
    numeratorNode.addChildNode(paymentNode);
    denominatorNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    denominatorNode.putValue(type, SubPopulationLabel.DENOM.name());
    denominatorNode.addChildNode(paymentNode);
    denominatorNode.addChildNode(aggregateCountNode);
    encoder = new QualityMeasureIdEncoder(new Context());
    wrapper = new JsonWrapper();
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 42 with Context

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

the class QualitySectionEncoderTest method internalEncodeNegative.

@Test
void internalEncodeNegative() throws EncodeException {
    Node qualitySectionNode = getQualitySectionNode();
    qualitySectionNode.addChildNode(new Node());
    QualitySectionEncoder encoder = new QualitySectionEncoder(new Context());
    JsonWrapper jsonWrapper = new JsonWrapper();
    encoder.internalEncode(jsonWrapper, qualitySectionNode);
    assertThat(encoder.getDetails()).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.ENCODER_MISSING);
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 43 with Context

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

the class QualitySectionEncoderTest method internalEncode.

@Test
void internalEncode() throws EncodeException {
    Node qualitySectionNode = getQualitySectionNode();
    QualitySectionEncoder encoder = new QualitySectionEncoder(new Context());
    JsonWrapper jsonWrapper = new JsonWrapper();
    encoder.internalEncode(jsonWrapper, qualitySectionNode);
    assertThat(jsonWrapper.getString("category")).isEqualTo("quality");
    assertThat(jsonWrapper.getString("submissionMethod")).isEqualTo("electronicHealthRecord");
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 44 with Context

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

the class ReportingParametersActEncoderTest method missingValuesTest.

@Test
void missingValuesTest() throws Exception {
    Node reportingParametersActNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT);
    JsonWrapper outputWrapper = new JsonWrapper();
    ReportingParametersActEncoder encoder = new ReportingParametersActEncoder(new Context());
    encoder.internalEncode(outputWrapper, reportingParametersActNode);
    String performanceStart = outputWrapper.getString(ReportingParametersActEncoder.PERFORMANCE_START);
    String performanceEnd = outputWrapper.getString(ReportingParametersActEncoder.PERFORMANCE_END);
    assertThat(performanceStart).isNull();
    assertThat(performanceEnd).isNull();
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 45 with Context

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

the class DefaultEncoderTest method encodeAllNodes.

@Test
void encodeAllNodes() throws Exception {
    InputStream stream = NioHelper.fileToStream(Paths.get("../qrda-files/valid-QRDA-III.xml"));
    String xmlFragment = IOUtils.toString(stream, StandardCharsets.UTF_8);
    Node node = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
    Node placeHolder = new Node(TemplateId.DEFAULT, node);
    node.addChildNode(placeHolder);
    JsonWrapper wrapper = new JsonWrapper();
    new QppOutputEncoder(new Context()).encode(wrapper, node);
    assertThat(wrapper.toString().length() > 10).isTrue();
}
Also used : Context(gov.cms.qpp.conversion.Context) JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) QppOutputEncoder(gov.cms.qpp.conversion.encode.QppOutputEncoder) InputStream(java.io.InputStream) Node(gov.cms.qpp.conversion.model.Node) QrdaDecoderEngine(gov.cms.qpp.conversion.decode.QrdaDecoderEngine) Test(org.junit.jupiter.api.Test)

Aggregations

Context (gov.cms.qpp.conversion.Context)114 Test (org.junit.jupiter.api.Test)92 Node (gov.cms.qpp.conversion.model.Node)63 BufferedWriter (java.io.BufferedWriter)17 StringWriter (java.io.StringWriter)17 QrdaDecoderEngine (gov.cms.qpp.conversion.decode.QrdaDecoderEngine)14 Element (org.jdom2.Element)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 QppOutputEncoder (gov.cms.qpp.conversion.encode.QppOutputEncoder)8 ArrayList (java.util.ArrayList)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 TemplateId (gov.cms.qpp.conversion.model.TemplateId)4 Detail (gov.cms.qpp.conversion.model.error.Detail)4 InputStream (java.io.InputStream)4 Namespace (org.jdom2.Namespace)4 Map (java.util.Map)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 Converter (gov.cms.qpp.conversion.Converter)2 PathSource (gov.cms.qpp.conversion.PathSource)2 ComponentKey (gov.cms.qpp.conversion.model.ComponentKey)2