Search in sources :

Example 36 with Context

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

the class MeasureDataDecoderTest method before.

@BeforeEach
void before() throws XmlException {
    Context context = new Context();
    QrdaDecoderEngine engine = new QrdaDecoderEngine(context);
    placeholder = engine.decode(XmlUtils.stringToDom(happy));
}
Also used : Context(gov.cms.qpp.conversion.Context) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 37 with Context

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

the class NullReturnDecoderTest method decodeReturnNullNode.

@Test
void decodeReturnNullNode() throws Exception {
    String xmlFragment = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\">\n" + "	<null resultName=\"result\" resultValue=\"mytestvalue\">\n" + "		<templateId root=\"null.return\"/>\n" + "	</null>" + "</root>";
    // Get the root wrapper node
    Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
    // We get a placeholder when the decoder returns null Node
    assertWithMessage("root node should have one child node").that(root.getType()).isEquivalentAccordingToCompareTo(TemplateId.PLACEHOLDER);
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 38 with Context

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

the class PerformanceRateProportionMeasureDecoderTest method decodeNodeFromFile.

private void decodeNodeFromFile(String filename) throws XmlException {
    context = new Context();
    PerformanceRateProportionMeasureDecoder decoder = new PerformanceRateProportionMeasureDecoder(context);
    QrdaDecoderEngine engine = new QrdaDecoderEngine(context);
    placeholder = engine.decode(XmlUtils.stringToDom(filename));
}
Also used : Context(gov.cms.qpp.conversion.Context)

Example 39 with Context

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

the class QrdaDecoderEngineTest method mockDecoders.

@BeforeAll
static void mockDecoders() {
    context = new Context();
    TestHelper.mockDecoder(context, TestChildContinue.class, new ComponentKey(TemplateId.ACI_SECTION, Program.ALL));
    TestHelper.mockDecoder(context, TestChildFinish.class, new ComponentKey(TemplateId.IA_SECTION, Program.ALL));
    TestHelper.mockDecoder(context, TestChildEscape.class, new ComponentKey(TemplateId.MEASURE_SECTION_V2, Program.ALL));
}
Also used : Context(gov.cms.qpp.conversion.Context) ComponentKey(gov.cms.qpp.conversion.model.ComponentKey) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 40 with Context

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

the class PlaceholderEncoderTest method encodePlaceholderNodeNegative.

@Test
void encodePlaceholderNodeNegative() throws EncodeException {
    // setup
    Node placeHolder = new Node(TemplateId.PLACEHOLDER);
    placeHolder.addChildNode(new Node());
    JsonWrapper wrapper = new JsonWrapper();
    PlaceholderEncoder encoder = new PlaceholderEncoder(new Context());
    // when
    encoder.internalEncode(wrapper, placeHolder);
    // then
    assertThat(encoder.getDetails()).hasSize(1);
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) 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