class JavadocAssertionTestSuite
extends TestSuite
JavadocAssertionTestSuite will dynamically create test cases from Groovy assertions placed within
Javadoc comments. Assertions should be placed within an html tag with a class="groovyTestCase"
attribute assignment. Example:
<pre class="groovyTestCase"> assert "example".size() == 7 </pre>
Source files will be read from the directory specified by the javadocAssertion.src.dir
system property, including all files matching javadocAssertion.src.pattern and
excluding files matching the javadocAssertion.src.excludesPattern.
By default all .java and .groovy source files from ./src will
be scanned for assertions.
You can also run this class as an application from the command line (assumes Groovy, JUnit and Ant
are on the classpath). As an example:
java groovy.test.JavadocAssertionTestSuite src/main
Note: this class requires the Ant module at runtime.
| Modifiers | Name | Description |
|---|---|---|
static String |
SYSPROP_SRC_DIR |
The System Property to set as base directory for collection of Classes. |
static String |
SYSPROP_SRC_EXCLUDES_PATTERN |
The System Property to set as a filename excludes pattern for collection of Classes. |
static String |
SYSPROP_SRC_PATTERN |
The System Property to set as the filename pattern for collection of Classes. |
| Constructor and description |
|---|
JavadocAssertionTestSuite() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static void |
main(String[] args)Runs the suite named by args: one argument is the base directory,
two add the include pattern, three add the exclude pattern. |
|
static Test |
suite()Builds a suite from the directory named by the javadocAssertion.src.dir system property, or {@code . |
|
static Test |
suite(String basedir)Builds a suite for basedir. |
|
static Test |
suite(String basedir, String includePattern)Builds a suite for basedir, keeping files that match
includePattern. |
|
static Test |
suite(String basedir, String includePattern, String excludePattern)Builds a suite from the Javadoc examples under basedir.
|
The System Property to set as base directory for collection of Classes.
The pattern will be used as an Ant fileset include basedir.
Key is "javadocAssertion.src.dir".
Defaults to the ./src directory
The System Property to set as a filename excludes pattern for collection of Classes. When non-empty, the pattern will be used as Regular Expression pattern applied with the find operator against each candidate file.path. Key is "javadocAssertion.src.excludesPattern". Default value is "".
The System Property to set as the filename pattern for collection of Classes.
The pattern will be used as Regular Expression pattern applied with the find
operator against each candidate file.path.
Key is "javadocAssertion.src.pattern".
Defaults to including all .java and .groovy files.
Runs the suite named by args: one argument is the base directory,
two add the include pattern, three add the exclude pattern.
args - base directory, then optional include and exclude patterns Builds a suite from the directory named by the
javadocAssertion.src.dir system property, or ./src/
when that property is unset. Files are included by
javadocAssertion.src.pattern, or **/*.java,**/*.groovy
when that property is unset.
Builds a suite for basedir. Files are included by the
javadocAssertion.src.pattern system property, or
**/*.java,**/*.groovy when that property is unset.
basedir - the directory to scan Builds a suite for basedir, keeping files that match
includePattern. Excludes files matching the
javadocAssertion.src.excludesPattern system property, which is empty by default.
basedir - the directory to scanincludePattern - ant-style include pattern Builds a suite from the Javadoc examples under basedir.
basedir must exist. A file whose generated test class is null
is skipped.
basedir - the directory to scanincludePattern - ant-style include patternexcludePattern - ant-style exclude patternCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.