use of org.asciidoctor.ast.Block in project drools by kiegroup.
the class ADocFEELExamplesTest method processBlock.
private void processBlock(StructuralNode block) {
List<StructuralNode> blocks = block.getBlocks();
for (int i = 0; i < blocks.size(); i++) {
final StructuralNode currentBlock = blocks.get(i);
if (currentBlock instanceof StructuralNode) {
if (currentBlock instanceof DescriptionList) {
DescriptionList descriptionList = (DescriptionList) currentBlock;
for (DescriptionListEntry dle : descriptionList.getItems()) {
ListItem description = dle.getDescription();
processBlock(description);
}
} else if ("listing".equals(currentBlock.getContext())) {
Block b = (Block) currentBlock;
List<String> lines = b.getLines();
LOG.trace("{}", lines);
LOG.trace("{}", b.getAttributes());
if (b.getAttribute("language", "unknown").equals("FEEL")) {
for (String line : lines) {
LOG.info("checking DOC {}", line);
Object FEELResult = feel.evaluate(line);
Assert.assertThat(line, FEELResult, Matchers.is(true));
}
} else {
LOG.trace("This block is not FEEL true predicate snippets: {}", b);
}
} else {
processBlock(currentBlock);
}
}
}
}
Aggregations