Search in sources :

Example 86 with Context

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

the class AciProportionDenominatorEncoderTest method runEncoder.

private void runEncoder() {
    AciProportionDenominatorEncoder encoder = new AciProportionDenominatorEncoder(new Context());
    try {
        encoder.internalEncode(json, aciProportionDenominatorNode);
    } catch (EncodeException e) {
        throw new RuntimeException(e);
    }
    encoder.setNodes(nodes);
}
Also used : Context(gov.cms.qpp.conversion.Context)

Example 87 with Context

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

the class AciProportionNumeratorEncoderTest method testInternalEncode.

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

Example 88 with Context

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

the class TemplateIdTest method testGetTemplateIdHistoricalWithExtension.

@Test
void testGetTemplateIdHistoricalWithExtension() {
    Context context = new Context();
    context.setHistorical(true);
    assertThat(TemplateId.CLINICAL_DOCUMENT.getTemplateId(context)).isEqualTo(TemplateId.CLINICAL_DOCUMENT.getRoot());
}
Also used : Context(gov.cms.qpp.conversion.Context) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 89 with Context

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

the class TemplateIdTest method testInvalidExtensionFindWithNoExtensionEnforcement.

@ParameterizedTest
@EnumSource(value = TemplateId.class, mode = EXCLUDE, names = { "CLINICAL_DOCUMENT" })
void testInvalidExtensionFindWithNoExtensionEnforcement(TemplateId templateId) {
    TemplateId actual = TemplateId.getTemplateId(templateId.getRoot(), "nonExistingExtension", new Context());
    assertThat(actual).isSameAs(templateId);
}
Also used : Context(gov.cms.qpp.conversion.Context) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 90 with Context

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

the class IaSectionValidatorRoundTripTest method testIaSectionValidatorIncorrectChildren.

@Test
void testIaSectionValidatorIncorrectChildren() {
    Path path = Paths.get("src/test/resources/negative/iaSectionContainsWrongChild.xml");
    Context context = new Context();
    context.setDoDefaults(true);
    Converter converter = new Converter(new PathSource(path), context);
    AllErrors errors = new AllErrors();
    try {
        converter.transform();
    } catch (TransformException exception) {
        errors = exception.getDetails();
    }
    Integer error = errors.getErrors().get(0).getDetails().get(0).getErrorCode();
    assertThat(ErrorCode.getByCode(error)).isEqualTo(ErrorCode.IA_SECTION_WRONG_CHILD);
}
Also used : Path(java.nio.file.Path) Context(gov.cms.qpp.conversion.Context) AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) 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