This class can be used via Concordion fixtures to include parts from the source code of the fixture into the concordion test page during test execution. This can be handy when the concordion test is the actual documentation of some library. You can import source lines that are between
SNIPPET START: nameand
SNIPPET END: namelines. This page was also created this way.
To use the utility the test fixture class should be embedded as the following:
@RunWith(ConcordionRunner.class)
@Extensions(EmbedExtension.class)
@FullOGNL
Yes, this code was embedded to he HTML page using the concordion embed extension and the snippet class.
It is recommended that the fixture class declares a field to hold a Snippet object:
private final Snippet snippet = new Snippet(this.getClass());
and since Concordion can invoke methods only from the fixture you also have to define a method that delegates to the Snippet
object the task to collect the lines from the source.
public String snippet(String snippetName) throws FileNotFoundException, IOException {
return snippet.snippet(snippetName);
}