use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class SupplementalDataPayerDecoderTest method decodeNodeFromFile.
private void decodeNodeFromFile(String filename) throws XmlException {
context = new Context();
SupplementalDataPayerDecoder decoder = new SupplementalDataPayerDecoder(context);
QrdaDecoderEngine engine = new QrdaDecoderEngine(context);
root = engine.decode(XmlUtils.stringToDom(filename));
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class SupplementalDataRaceDecoderTest method decodeNodeFromFile.
private void decodeNodeFromFile(String filename) throws XmlException {
context = new Context();
SupplementalDataRaceDecoder decoder = new SupplementalDataRaceDecoder(context);
QrdaDecoderEngine engine = new QrdaDecoderEngine(context);
root = engine.decode(XmlUtils.stringToDom(filename));
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciMeasurePerformedRnREncoderTest method testInternalEncodeBooleanStringValue.
@Test
void testInternalEncodeBooleanStringValue() {
// set-up
JsonWrapper jsonWrapper = new JsonWrapper();
AciMeasurePerformedRnREncoder objectUnderTest = new AciMeasurePerformedRnREncoder(new Context());
String unknownValue = "Some unknown value";
aciMeasurePerformedRnR.getChildNodes().get(0).putValue("measurePerformed", unknownValue);
// execute
objectUnderTest.internalEncode(jsonWrapper, aciMeasurePerformedRnR);
// assert
assertThat(jsonWrapper.getString("measureId")).isEqualTo(MEASURE_ID);
assertThat(jsonWrapper.getString("value")).isEqualTo(unknownValue);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciNumeratorDenominatorEncoderTest method testEncoder.
@Test
void testEncoder() {
QppOutputEncoder encoder = new QppOutputEncoder(new Context());
encoder.setNodes(nodes);
StringWriter sw = new StringWriter();
try {
encoder.encode(new BufferedWriter(sw));
} catch (EncodeException e) {
Assertions.fail("Failure to encode: " + e.getMessage());
}
String EXPECTED = "{\n \"measureId\" : \"" + MEASURE_ID + "\",\n \"value\" : {\n \"numerator\" : 400,\n \"denominator\" : 600\n }\n}";
assertThat(sw.toString()).isEqualTo(EXPECTED);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciNumeratorDenominatorEncoderTest method testNoChildEncoder.
@Test
void testNoChildEncoder() throws EncodeException {
JsonWrapper jsonWrapper = new JsonWrapper();
AciNumeratorDenominatorEncoder objectUnderTest = new AciNumeratorDenominatorEncoder(new Context());
Node unknownNode = new Node();
aciProportionMeasureNode.addChildNode(unknownNode);
// execute
objectUnderTest.internalEncode(jsonWrapper, aciProportionMeasureNode);
// assert
assertThat(objectUnderTest.getDetails()).hasSize(1);
assertWithMessage("The validation error must be the inability to find an encoder").that(objectUnderTest.getDetails().get(0).getMessage()).isEqualTo(ErrorCode.CT_LABEL + "Failed to find an encoder");
}
Aggregations