use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class EncoderNegativeConditionsTest method testNullEncoder.
@Test
void testNullEncoder() {
QppOutputEncoder encoder = new QppOutputEncoder(new Context());
Node aNode = new Node();
aNode.putValue("something", "600");
List<Node> nodes = new ArrayList<>();
nodes.add(aNode);
encoder.setNodes(nodes);
StringWriter sw = new StringWriter();
try {
encoder.encode(new BufferedWriter(sw));
} catch (EncodeException e) {
Assertions.fail("Failure to encode: " + e.getMessage());
}
// NOTE: This test is only relevant in that it finds the deep value but
// it is not actually a result
String expected = "null";
assertThat(sw.toString()).isEqualTo(expected);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class EncoderNegativeConditionsTest method testExceptionAddsValidation.
@Test
void testExceptionAddsValidation() throws EncodeException {
Node numeratorDenominatorNode;
List<Node> nodes;
numeratorDenominatorNode = new Node(TemplateId.ACI_AGGREGATE_COUNT);
numeratorDenominatorNode.putValue("aggregateCount", "600");
nodes = new ArrayList<>();
nodes.add(numeratorDenominatorNode);
QppOutputEncoder encoder = new QppOutputEncoder(new Context());
encoder.setNodes(nodes);
FailingWriter failWrite = new FailingWriter();
encoder.encode(new BufferedWriter(failWrite));
assertThat(encoder.getDetails()).hasSize(1);
assertThat(encoder.getDetails().get(0).getMessage()).isEqualTo("Fake IOException");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class IaSectionEncoderTest method testEncoderWithoutMeasure.
@Test
void testEncoderWithoutMeasure() {
iaSectionNode.getChildNodes().remove(iaMeasureNode);
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);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class IaSectionEncoderTest 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 NoArgThrowableConstructor method before.
@BeforeEach
void before() {
context = new Context();
registry = context.getRegistry(Decoder.class);
}
Aggregations