use of gov.cms.qpp.conversion.decode.QrdaDecoderEngine in project qpp-conversion-tool by CMSgov.
the class CpcMeasureDataValidatorTest method validateFailureSupplementalDataMissingCountTest.
@Test
void validateFailureSupplementalDataMissingCountTest() throws Exception {
String failurePayerFile = TestHelper.getFixture("failureSupplementalDataCountFile.xml");
Node placeholder = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(failurePayerFile));
CpcMeasureDataValidator validator = new CpcMeasureDataValidator();
Node underTest = placeholder.findFirstNode(TemplateId.MEASURE_DATA_CMS_V2);
validator.internalValidateSingleNode(underTest);
LocalizedError expectedError = ErrorCode.CPC_PLUS_SUPPLEMENTAL_DATA_MISSING_COUNT.format(SupplementalData.MALE.getCode(), SubPopulationLabel.IPOP.name(), MEASURE_ID);
Set<Detail> errors = validator.getDetails();
assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(expectedError);
}
use of gov.cms.qpp.conversion.decode.QrdaDecoderEngine in project qpp-conversion-tool by CMSgov.
the class CpcMeasureDataValidatorTest method validateSuccessfulSupplementalDataFieldsTest.
@Test
void validateSuccessfulSupplementalDataFieldsTest() throws Exception {
String successfulFile = TestHelper.getFixture("successfulSupplementalDataFile.xml");
Node placeholder = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(successfulFile));
CpcMeasureDataValidator validator = new CpcMeasureDataValidator();
Node underTest = placeholder.findFirstNode(TemplateId.MEASURE_DATA_CMS_V2);
validator.internalValidateSingleNode(underTest);
Set<Detail> errors = validator.getDetails();
assertThat(errors).isEmpty();
}
use of gov.cms.qpp.conversion.decode.QrdaDecoderEngine in project qpp-conversion-tool by CMSgov.
the class DefaultDecoderTest method parseAllNodes.
@Test
void parseAllNodes() 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));
assertThat(node).isNotNull();
}
use of gov.cms.qpp.conversion.decode.QrdaDecoderEngine 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();
}
use of gov.cms.qpp.conversion.decode.QrdaDecoderEngine in project qpp-conversion-tool by CMSgov.
the class MeasureDataValidatorTest method internalValidateSingleNode.
@Test
void internalValidateSingleNode() throws Exception {
String happy = TestHelper.getFixture("measureDataHappy.xml");
Node placeholder = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(happy));
MeasureDataValidator validator = new MeasureDataValidator();
Node underTest = placeholder.findFirstNode(TemplateId.MEASURE_DATA_CMS_V2);
validator.internalValidateSingleNode(underTest);
Set<Detail> errors = validator.getDetails();
assertWithMessage("Expect no errors on the happy path").that(errors).isEmpty();
}
Aggregations