diff options
| author | Stefan Bodewig <bodewig@apache.org> | 2016-07-13 20:28:32 +0200 |
|---|---|---|
| committer | Stefan Bodewig <bodewig@apache.org> | 2016-09-11 12:10:15 +0200 |
| commit | 31cc48c6f70b8c24f79aa5f17f80c32f8480e2f9 (patch) | |
| tree | 29950f72f5b91df968a58dc011c8684c5150e79b /manual | |
| parent | 1d7b624155b06f665c8b99014227bc1f87f9ec54 (diff) | |
| download | ant-31cc48c6f70b8c24f79aa5f17f80c32f8480e2f9.tar.gz | |
JDK9 modules support for JUnit by Tomáš Zezula
this is the combined patch or #18 which couldn't be applied via `git am`
Diffstat (limited to 'manual')
| -rw-r--r-- | manual/Tasks/junit.html | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/manual/Tasks/junit.html b/manual/Tasks/junit.html index 76df9ced6..9f6051217 100644 --- a/manual/Tasks/junit.html +++ b/manual/Tasks/junit.html @@ -371,6 +371,21 @@ subelement.</p> <p><em>since Ant 1.6.</em></p> +<h4>modulepath</h4> + +<p>The location of modules can be specified using this <a href="../using.html#path">PATH like structure</a>.<br/> +The modulepath requires <i>fork</i> to be set to <code>true</code>. + +<p><em>since Ant 1.10</em></p> + +<h4>upgrademodulepath</h4> + +<p>The location of modules that replace upgradeable modules in the runtime image +can be specified using this <a href="../using.html#path">PATH like structure</a>.<br/> +The upgrademodulepath requires <i>fork</i> to be set to <code>true</code>. + +<p><em>since Ant 1.10</em></p> + <h4>formatter</h4> <p>The results of the tests can be printed in different @@ -796,7 +811,47 @@ the single <code><test/></code> will run. So only the failing test cases a The two nested formatters are for displaying (for the user) and for updating the collector class. </p> - - +<pre> + <junit fork="true" + jvm="${platform.java}"> + <jvmarg value="-Xpatch:${module.name}=${build.test.classes}"/> + <jvmarg line="-addmods ${module.name}"/> + <jvmarg value="-XaddReads:${module.name}=ALL-UNNAMED"/> + <jvmarg value="-XaddExports:${module.name}/my.test=ALL-UNNAMED"/> + <classpath> + <pathelement path="${libs.junit}"/> + </classpath> + <modulepath> + <pathelement path="${modules}:${build.classes}"/> + </modulepath> + <formatter type="plain"/> + <test name="my.test.TestCase"/> + </junit> +</pre> +<p>Runs my.test.TestCase as a white-box test in the forked VM given by the <code>platform.java</code> property. +The junit library is a part of an unnamed module while the tested project and required modules are on the module path. The tests +do not have module-info file and are executed in the project module given by <code>module.name</code> property.<br/> +The <code>-Xpatch</code> java option executes the tests built into <code>${build.test.classes}</code> in a module given +by <code>module.name</code> property.<br/> +The <code>-addmods</code> java option enables the tested module.<br/> +The <code>-XaddReads</code> java option makes the unnamed module containing the junit readable by tested module.<br/> +The <code>-XaddExports</code> java option makes the non-exported test package <code>my.test</code> accessible from the unnamed module containing the junit.<br/> +<pre> + <junit fork="true" + jvm="${platform.java}"> + <jvmarg line="-addmods ${test.module.name}"/> + <jvmarg value="-XaddExports:${test.module.name}/my.test=junit,ALL-UNNAMED"/> + <modulepath> + <pathelement path="${modules}:${build.classes}:${libs.junit}"/> + </modulepath> + <formatter type="plain"/> + <test name="my.test.TestCase"/> + </junit> +</pre> +<p>Runs my.test.TestCase as a black-box test in the forked VM given by the <code>platform.java</code> property. +The junit library is used as an automatic module. The tests module-info requires the tested module and junit.<br/> +The <code>-addmods</code> java option enables the test module.<br/> +The <code>-XaddExports</code> java option makes the non-exported test package <code>my.test</code> accessible from the junit module and Ant's test runner. +Another possibility is to export the test package in the tests module-info by <code>exports my.test</code> directive.<br/> </body> </html> |
