use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciSectionEncoderMultiMeasureTest 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());
}
assertThat(sw.toString()).isEqualTo(EXPECTED);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciSectionEncoderTest method testInternalEncodeWithNoChildren.
@Test
void testInternalEncodeWithNoChildren() {
JsonWrapper testWrapper = new JsonWrapper();
Node invalidAciNumeratorDenominatorNode = new Node();
aciSectionNode = new Node(TemplateId.ACI_SECTION);
aciSectionNode.putValue(CATEGORY, ACI);
aciSectionNode.addChildNode(invalidAciNumeratorDenominatorNode);
aciSectionNode.addChildNode(reportingParametersNode);
AciSectionEncoder aciSectionEncoder = new AciSectionEncoder(new Context());
aciSectionEncoder.internalEncode(testWrapper, aciSectionNode);
assertThat(aciSectionEncoder.getDetails()).isNotNull();
assertThat(aciSectionEncoder.getDetails().get(0).getMessage()).isEqualTo(ErrorCode.CT_LABEL + "Failed to find an encoder");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciSectionEncoderTest method testInternalEncode.
@Test
void testInternalEncode() {
JsonWrapper jsonWrapper = new JsonWrapper();
AciSectionEncoder aciSectionEncoder = new AciSectionEncoder(new Context());
aciSectionEncoder.internalEncode(jsonWrapper, aciSectionNode);
Map<?, ?> testMapObject = (Map<?, ?>) jsonWrapper.getObject();
assertWithMessage("Must have a child node").that(testMapObject).isNotNull();
assertWithMessage("Must be category ACI").that(testMapObject.get(CATEGORY)).isEqualTo(ACI);
assertWithMessage("Must have measurements").that(testMapObject.get(MEASUREMENTS)).isNotNull();
assertWithMessage("Must have submissionMethod").that(testMapObject.get(SUBMISSION_METHOD)).isEqualTo(ELECTRONIC_HEALTH_RECORD);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentEncoderTest method testInternalEncodeNullEntityId.
@Test
void testInternalEncodeNullEntityId() throws EncodeException {
clinicalDocumentNode.getChildNodes().remove(aciSectionNode);
clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_ID, null);
JsonWrapper testJsonWrapper = new JsonWrapper();
ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context());
clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode);
Map<?, ?> clinicalDocMap = ((Map<?, ?>) testJsonWrapper.getObject());
assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.ENTITY_ID)).isNull();
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentEncoderTest method testPerformanceYear.
@Test
void testPerformanceYear() {
JsonWrapper testJsonWrapper = new JsonWrapper();
ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context());
clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode);
Object performanceYear = testJsonWrapper.getValue(ReportingParametersActDecoder.PERFORMANCE_YEAR);
assertThat(performanceYear).isEqualTo(2017);
}
Aggregations