And if you need a modular jar, you might look at ModuleLauncherTest instead.
-- Kevin
On 1/31/2020 7:35 AM, Kevin Rushforth wrote:
Take a look at the JarLauncherTest in the tests/system dir. There is
some (ugly) build logic in build.gradle to support it.
-- Kevin
On 1/31/2020 7:28 AM, Rony G. Flatscher wrote:
How would one go about creating a testcase that needs a jar-file
either on the class- or module path?
Are there any test units that would demonstrate how to do it? If not,
what approach would you
suggest (and if so, are there any samples already somewhere to study)?
---
Background: for creating a testcase using a pseudo script engine
("RgfPseudoScriptEngine") that logs
its invocations with the script context Bindings for each invocation
and which then will be analyzed
and used for the test assertions, there is a need to have the pseudo
script engine made available
via the Java scripting framework.
There is a jar-file (that includes the sources as well) with the
necessary definitions:
* via class path:
"META-INF/services/javax.script.ScriptEngineFactory" entry:
rgf.scriptEngine.RgfPseudoScriptEngineFactory
* via module path which will use the information in
"module-info.java":
module rgf.scriptEngine {
requires java.scripting;
provides javax.script.ScriptEngineFactory with
rgf.scriptEngine.RgfPseudoScriptEngineFactory;
exports rgf.scriptEngine;
}
TIA,
---rony