use of gov.cms.qpp.conversion.model.TemplateId 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.model.TemplateId in project qpp-conversion-tool by CMSgov.
the class DecoderTest method decodeTemplateIds.
@Test
void decodeTemplateIds() throws Exception {
Registry<QrdaDecoder> registry = new Registry<>(new Context(), Decoder.class);
for (TemplateId templateId : templateIds) {
QrdaDecoder decoder = registry.get(templateId);
assertWithMessage("%s returned node should not be null", templateId.name()).that(decoder).isNotNull();
}
}
use of gov.cms.qpp.conversion.model.TemplateId in project qpp-conversion-tool by CMSgov.
the class Checker method onlyHasChildren.
/**
* Verifies that the target node contains only children of specified template ids
*
* @param code that identifies the error
* @param types types of template ids to filter
* @return The checker, for chaining method calls.
*/
Checker onlyHasChildren(LocalizedError code, TemplateId... types) {
if (!shouldShortcut()) {
Set<TemplateId> templateIds = EnumSet.noneOf(TemplateId.class);
for (TemplateId templateId : types) {
templateIds.add(templateId);
}
boolean valid = node.getChildNodes().stream().allMatch(childNode -> templateIds.contains(childNode.getType()));
if (!valid) {
details.add(detail(code));
}
}
return this;
}
Aggregations