use of gov.cms.qpp.conversion.Context 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.Context in project qpp-conversion-tool by CMSgov.
the class DefaultDecoderTest method testInternalDecode.
@Test
void testInternalDecode() {
DefaultDecoder decoder = new DefaultDecoder(new Context(), "mock");
Node node = new Node();
decoder.decode(null, node);
Truth.assertThat(node.getValue("DefaultDecoderFor")).isEqualTo("mock");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciMeasurePerformedRnREncoderTest method testEncoder.
@Test
@SuppressWarnings("unchecked")
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());
}
Map<String, Object> content = JsonHelper.readJson(new ByteArrayInputStream(sw.toString().getBytes()), Map.class);
assertThat(content.get("measureId")).isEqualTo(MEASURE_ID);
assertThat(content.get("value")).isEqualTo(true);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciMeasurePerformedRnREncoderTest method testInternalEncodeNoChildNoValue.
@Test
void testInternalEncodeNoChildNoValue() {
// set-up
JsonWrapper jsonWrapper = new JsonWrapper();
AciMeasurePerformedRnREncoder objectUnderTest = new AciMeasurePerformedRnREncoder(new Context());
aciMeasurePerformedRnR.setChildNodes();
// execute
objectUnderTest.internalEncode(jsonWrapper, aciMeasurePerformedRnR);
// assert
assertThat(jsonWrapper.getString("measureId")).isEqualTo(MEASURE_ID);
assertThat(jsonWrapper.getBoolean("value")).isNull();
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciMeasurePerformedRnREncoderTest method testInternalEncode.
@Test
void testInternalEncode() {
// set-up
JsonWrapper jsonWrapper = new JsonWrapper();
AciMeasurePerformedRnREncoder objectUnderTest = new AciMeasurePerformedRnREncoder(new Context());
// execute
objectUnderTest.internalEncode(jsonWrapper, aciMeasurePerformedRnR);
// assert
assertThat(jsonWrapper.getString("measureId")).isEqualTo(MEASURE_ID);
assertThat(jsonWrapper.getBoolean("value")).isEqualTo(true);
}
Aggregations