Search in sources :

Example 31 with Context

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

the class AciMeasurePerformedRnREncoderTest method testInternalEncodeBooleanFalseValue.

@Test
void testInternalEncodeBooleanFalseValue() {
    // set-up
    JsonWrapper jsonWrapper = new JsonWrapper();
    AciMeasurePerformedRnREncoder objectUnderTest = new AciMeasurePerformedRnREncoder(new Context());
    aciMeasurePerformedRnR.getChildNodes().get(0).putValue("measurePerformed", "N");
    // execute
    objectUnderTest.internalEncode(jsonWrapper, aciMeasurePerformedRnR);
    // assert
    assertThat(jsonWrapper.getString("measureId")).isEqualTo(MEASURE_ID);
    assertThat(jsonWrapper.getBoolean("value")).isEqualTo(false);
}
Also used : Context(gov.cms.qpp.conversion.Context) Test(org.junit.jupiter.api.Test)

Example 32 with Context

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

the class AciMeasurePerformedRnREncoderTest method testInternalEncodeBooleanTrueValue.

@Test
void testInternalEncodeBooleanTrueValue() {
    // set-up
    JsonWrapper jsonWrapper = new JsonWrapper();
    AciMeasurePerformedRnREncoder objectUnderTest = new AciMeasurePerformedRnREncoder(new Context());
    aciMeasurePerformedRnR.getChildNodes().get(0).putValue("measurePerformed", "Y");
    // execute
    objectUnderTest.internalEncode(jsonWrapper, aciMeasurePerformedRnR);
    // assert
    assertThat(jsonWrapper.getString("measureId")).isEqualTo(MEASURE_ID);
    assertThat(jsonWrapper.getBoolean("value")).isEqualTo(true);
}
Also used : Context(gov.cms.qpp.conversion.Context) Test(org.junit.jupiter.api.Test)

Example 33 with Context

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

the class AciNumeratorDenominatorEncoderTest method testInternalEncode.

@Test
void testInternalEncode() throws EncodeException {
    // set-up
    JsonWrapper jsonWrapper = new JsonWrapper();
    AciNumeratorDenominatorEncoder objectUnderTest = new AciNumeratorDenominatorEncoder(new Context());
    // execute
    objectUnderTest.internalEncode(jsonWrapper, aciProportionMeasureNode);
    // assert
    assertThat(jsonWrapper.getString("measureId")).isEqualTo(MEASURE_ID);
    assertThat(jsonWrapper.getObject()).isNotNull();
    assertThat(jsonWrapper.getObject()).isInstanceOf(Map.class);
    assertThat(((Map<?, ?>) jsonWrapper.getObject()).get("value")).isNotNull();
}
Also used : Context(gov.cms.qpp.conversion.Context) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 34 with Context

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

the class AciProportionNumeratorEncoderTest method testEncoderWithoutChild.

@Test
void testEncoderWithoutChild() throws EncodeException {
    aciProportionNumeratorNode.getChildNodes().remove(numeratorDenominatorValueNode);
    AciProportionNumeratorEncoder aciProportionNumeratorEncoder = new AciProportionNumeratorEncoder(new Context());
    aciProportionNumeratorEncoder.internalEncode(jsonWrapper, aciProportionNumeratorNode);
    assertThat(jsonWrapper.getInteger("numerator")).isNull();
}
Also used : Context(gov.cms.qpp.conversion.Context) Test(org.junit.jupiter.api.Test)

Example 35 with Context

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

the class AciProportionNumeratorEncoderTest method testEncoderWithoutValue.

@Test
void testEncoderWithoutValue() throws EncodeException {
    numeratorDenominatorValueNode.putValue("aggregateCount", null);
    AciProportionNumeratorEncoder aciProportionNumeratorEncoder = new AciProportionNumeratorEncoder(new Context());
    aciProportionNumeratorEncoder.internalEncode(jsonWrapper, aciProportionNumeratorNode);
    assertThat(jsonWrapper.getInteger("numerator")).isNull();
}
Also used : Context(gov.cms.qpp.conversion.Context) 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