use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentEncoderTest method testInternalEncodeEmptyEntityId.
@Test
void testInternalEncodeEmptyEntityId() throws EncodeException {
clinicalDocumentNode.getChildNodes().remove(aciSectionNode);
clinicalDocumentNode.putValue(ClinicalDocumentDecoder.ENTITY_ID, "");
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 testInternalEncodeWithoutMeasures.
@Test
void testInternalEncodeWithoutMeasures() throws EncodeException {
clinicalDocumentNode.getChildNodes().remove(aciSectionNode);
JsonWrapper testJsonWrapper = new JsonWrapper();
ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context());
clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode);
Map<?, ?> clinicalDocMap = ((Map<?, ?>) testJsonWrapper.getObject());
assertThat(clinicalDocMap.get(MEASUREMENT_SETS)).isNull();
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentEncoderTest method testInternalEncode.
@Test
void testInternalEncode() throws EncodeException {
JsonWrapper testJsonWrapper = new JsonWrapper();
ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context());
clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode);
Map<?, ?> clinicalDocMap = ((Map<?, ?>) testJsonWrapper.getObject());
assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.ENTITY_TYPE)).isEqualTo("individual");
assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)).isEqualTo("123456789");
assertThat(clinicalDocMap.get(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)).isEqualTo("2567891421");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class EncoderTest method decodeTemplateIds.
/**
* decodeTemplateIds for each TemplateId in the list ensure that it exists in
* the registry.
* @throws Exception
*/
@Test
void decodeTemplateIds() throws Exception {
Registry<OutputEncoder> registry = new Registry<>(new Context(), Encoder.class);
for (TemplateId templateId : templateIds) {
OutputEncoder encoder = registry.get(templateId);
assertWithMessage(templateId + " returned node should not be null").that(encoder).isNotNull();
}
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class IaSectionEncoderTest method testEncoderWithoutMeasureValue1.
@Test
void testEncoderWithoutMeasureValue1() {
iaMeasureNode.getChildNodes().remove(iaMeasurePerformedNode);
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_NO_MEASURE_VALUE_1);
}
Aggregations