use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.
the class QrdaControllerV1Test method initialization.
@BeforeEach
void initialization() throws IOException {
JsonWrapper wrapper = new JsonWrapper();
wrapper.putString("key", "Good Qpp");
when(report.getEncoded()).thenReturn(wrapper);
multipartFile = new MockMultipartFile(GOOD_FILE_CONTENT, new ByteArrayInputStream(GOOD_FILE_CONTENT.getBytes()));
}
use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.
the class DefaultEncoderTest method encodeDefaultNode.
@Test
void encodeDefaultNode() throws EncodeException {
Node root = new Node(TemplateId.DEFAULT);
Node placeHolder = new Node(TemplateId.PLACEHOLDER, root);
root.addChildNode(placeHolder);
JsonWrapper wrapper = new JsonWrapper();
new DefaultEncoder("Default Encode test").internalEncode(wrapper, root);
assertThat(wrapper.toString()).hasLength(3);
}
use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.
the class ConverterTest method testDefaults.
@Test
public void testDefaults() {
Context context = new Context();
context.setDoDefaults(true);
context.setDoValidation(false);
TestHelper.mockDecoder(context, JennyDecoder.class, new ComponentKey(TemplateId.DEFAULT, Program.ALL));
TestHelper.mockEncoder(context, Jenncoder.class, new ComponentKey(TemplateId.DEFAULT, Program.ALL));
Converter converter = new Converter(new PathSource(Paths.get("src/test/resources/converter/defaultedNode.xml")), context);
JsonWrapper qpp = converter.transform();
String content = qpp.toString();
assertThat(content).contains("Jenny");
}
use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.
the class ConverterTest method testSkipDefaults.
@Test
public void testSkipDefaults() {
Converter converter = new Converter(new PathSource(Paths.get("src/test/resources/converter/defaultedNode.xml")));
converter.getContext().setDoDefaults(false);
converter.getContext().setDoValidation(false);
JsonWrapper qpp = converter.transform();
String content = qpp.toString();
assertThat(content).doesNotContain("Jenny");
}
use of gov.cms.qpp.conversion.encode.JsonWrapper in project qpp-conversion-tool by CMSgov.
the class ScopedConversionTest method scopedConversion.
@SuppressWarnings("unchecked")
private Map<String, Object> scopedConversion(QrdaScope testSection) {
Converter converter = new Converter(new PathSource(Paths.get(SUCCESS_MAKER)));
converter.getContext().setScope(Sets.newHashSet(testSection));
JsonWrapper qpp = converter.transform();
return JsonHelper.readJson(qpp.toString(), HashMap.class);
}
Aggregations