use of gov.cms.qpp.conversion.xml.XmlException in project qpp-conversion-tool by CMSgov.
the class AciMeasurePerformedRnRDecoderTest method testUpperLevel.
@Test
void testUpperLevel() throws XmlException, IOException {
String needsFormattingXml = TestHelper.getFixture("AciMeasurePerformedIsolated.xml");
String xml = String.format(needsFormattingXml, MEASURE_ID);
Node wrapperNode = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xml));
Node aciMeasurePerformedNode = wrapperNode.getChildNodes().get(0);
String actualMeasureId = aciMeasurePerformedNode.getValue("measureId");
assertThat(actualMeasureId).isEqualTo(MEASURE_ID);
long measurePerformedCount = aciMeasurePerformedNode.getChildNodes(node -> node.getType() == TemplateId.MEASURE_PERFORMED).count();
assertThat(measurePerformedCount).isEqualTo(1L);
}
use of gov.cms.qpp.conversion.xml.XmlException in project qpp-conversion-tool by CMSgov.
the class ValidationApiAcceptance method verifyDetail.
private void verifyDetail(Detail detail) {
String xPath = detail.getPath();
Filter filter = xPath.contains("@") ? Filters.attribute() : Filters.element();
try {
Object found = evaluateXpath(detail.getPath(), filter);
if (filter.equals(Filters.attribute())) {
Attribute attribute = (Attribute) found;
assertThat(attribute.getIntValue()).isEqualTo(CANNED_VALUE);
assertThat(detail.getMessage()).startsWith(ValidationServiceImpl.SV_LABEL);
} else {
assertThat(found).isNotNull();
}
} catch (XmlException | DataConversionException ex) {
fail("This xpath could not be found: " + detail.getPath(), ex);
}
}
use of gov.cms.qpp.conversion.xml.XmlException in project qpp-conversion-tool by CMSgov.
the class JsonPathToXpathHelper method executeAttributeTest.
public void executeAttributeTest(String jsonPath, String expectedValue) {
String xPath = PathCorrelator.prepPath(jsonPath, wrapper);
Attribute attribute = null;
try {
attribute = evaluateXpath(xPath, Filters.attribute());
} catch (XmlException e) {
fail(e.getMessage());
}
if (CHECK_FOR_NULL_SET.stream().anyMatch(jsonPath::matches)) {
assertThat(attribute.getValue()).isNotNull();
} else {
assertWithMessage("( %s ) value ( %s ) does not equal ( %s ) at \n( %s ). \nPlease investigate.", jsonPath, expectedValue, attribute.getValue(), xPath).that(attribute.getValue()).isEqualTo(expectedValue);
}
}
Aggregations