use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AggregateCountDecoderTest method testAggregateCountDecoderIgnoresInvalidElementsPartTwo.
@Test
void testAggregateCountDecoderIgnoresInvalidElementsPartTwo() throws XmlException {
Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(ANOTHER_XML_FRAGMENT));
assertWithMessage("Node has aggregate count").that(root.getValue("aggregateCount")).isEqualTo("400");
assertWithMessage("Should have template id").that(root.getType()).isEqualTo(TemplateId.ACI_AGGREGATE_COUNT);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AggregateCountDecoderTest method testInternalDecode.
@Test
void testInternalDecode() {
Namespace rootNs = Namespace.getNamespace("urn:hl7-org:v3");
Namespace ns = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
Context context = new Context();
Element element = new Element("observation", rootNs);
element.addContent(new Element("templateId", rootNs).setAttribute("root", TemplateId.ACI_AGGREGATE_COUNT.getTemplateId(context)));
element.addContent(new Element("value", rootNs).setAttribute("value", "450").setAttribute("type", "INT", ns));
element.addNamespaceDeclaration(ns);
Node thisNode = new Node();
AggregateCountDecoder instance = new AggregateCountDecoder(context);
instance.setNamespace(element.getNamespace());
instance.decode(element, thisNode);
assertThat(thisNode.getValue("aggregateCount")).isEqualTo("450");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentDecoderTest method decodeClinicalDocumentInternalDecodeUnknown.
@Test
void decodeClinicalDocumentInternalDecodeUnknown() {
Element clinicalDocument = makeClinicalDocument("Unknown");
Node testParentNode = new Node();
ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context());
objectUnderTest.setNamespace(clinicalDocument.getNamespace());
objectUnderTest.decode(clinicalDocument, testParentNode);
assertWithMessage("Clinical Document doesn't contain program name").that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)).isEqualTo("unknown");
assertWithMessage("Clinical Document doesn't contain entity type").that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)).isEqualTo("individual");
assertWithMessage("Clinical Document doesn't contain national provider").that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)).isEqualTo("2567891421");
assertWithMessage("Clinical Document doesn't contain taxpayer id number").that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)).isEqualTo("123456789");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentDecoderTest method decodeClinicalDocumentInternalDecode.
@Test
void decodeClinicalDocumentInternalDecode() {
Element clinicalDocument = makeClinicalDocument("MIPS");
Node testParentNode = new Node();
ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context());
objectUnderTest.setNamespace(clinicalDocument.getNamespace());
objectUnderTest.decode(clinicalDocument, testParentNode);
assertWithMessage("Clinical Document doesn't contain program name").that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)).isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME);
assertWithMessage("Clinical Document doesn't contain entity type").that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)).isEqualTo(ClinicalDocumentDecoder.ENTITY_INDIVIDUAL);
assertWithMessage("Clinical Document doesn't contain national provider").that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)).isEqualTo("2567891421");
assertWithMessage("Clinical Document doesn't contain taxpayer id number").that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)).isEqualTo("123456789");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentDecoderTest method testClinicalDocumentIgnoresGarbage.
@Test
void testClinicalDocumentIgnoresGarbage() throws IOException, XmlException {
InputStream stream = ClasspathHelper.contextClassLoader().getResourceAsStream("QRDA-III-with-extra-elements.xml");
String xmlWithGarbage = IOUtils.toString(stream, StandardCharsets.UTF_8);
Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlWithGarbage));
clinicalDocument = root.findFirstNode(TemplateId.CLINICAL_DOCUMENT);
assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)).isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME);
assertThat(clinicalDocument.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)).isEqualTo("123456789");
}
Aggregations