class JavadocAssertionTestBuilder
extends Object
JavadocAssertionTestBuilder dynamically creates test cases from Groovy assertions placed within
the doc comments of a source file. Four authoring forms are recognised:
class="groovyTestCase":
/** <pre class="groovyTestCase"> assert "example".size() == 7 </pre> *//// runs) with the same HTML wrapper — Markdown
passes inline HTML through, so the existing convention works unchanged:
/// <pre class="groovyTestCase"> assert 1 + 1 == 2 </pre>/// run whose infostring is groovy groovyTestCase.
CommonMark uses the first word as the language (so Prism/highlight.js still highlight the body as Groovy); the
second word is the test marker recognised by this builder when it scans the source:
/// ```groovy groovyTestCase
/// assert 2 + 2 == 4
/// ```
{@snippet} tag with an id attribute of groovyTestCase.
The body is brace-balanced per JEP 413, so the containing assertion may use literal < /
> without HTML escaping. Any { / } pairs inside the body must still
balance (groovydoc's snippet parser does dumb brace counting with no string-awareness; the same rule applies here).
Uses id= rather than class= because JEP 413 interprets class= as a
reference to a source file on the snippet path — javadoc warns when that file isn't found.
/** {@snippet lang="groovy" id="groovyTestCase" :
assert "a<b>c".size() == 5
} */@code ...}
tag have the javadoc code tag stripped, and HTML entities are converted back so that < and
> become < and >. Fenced-block and {@snippet} extractions pass through
without HTML decoding because those forms hold raw source already.
| Constructor and description |
|---|
JavadocAssertionTestBuilder() |
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.