Closed sormuras closed 7 years ago
@forax The test tree of https://github.com/forax/pro/pull/29/commits/cb099265e7d53cf44c4a159cfbcdb2babefef203 shows an disabled test, that fails at the moment:
JUnit Jupiter:ConfigsTests:newRootIsNotNull()
MethodSource [
className = 'com.github.forax.pro.api.impl.ConfigsTests',
methodName = 'newRootIsNotNull', methodParameterTypes = '']
=> java.lang.IllegalAccessError:
class com.github.forax.pro.api.impl.ConfigsTests (in unnamed module @0x33065d67)
cannot access class com.github.forax.pro.api.impl.Configs (in module com.github.forax.pro.api)
because module com.github.forax.pro.api
does not export com.github.forax.pro.api.impl to unnamed module @0x33065d67
Both classes, Configs
and ConfigsTests
, reside in the same package, namely com.github.forax.pro.api.impl
. The compiler plugin compiles them from the test/merged to the test/exploded directory.
Maybe, the IAE is because of tester being a module and passing the modular environment to the JUnit Platform? I see at least two solutions:
module-info.java
more open
, as the merged module descriptor is too restrictive. The qualified export statements from the main module prevail over the "open" modifier introduced in the test module descriptor.java
tool call) to execute the ConsoleLauncher utilizing the classpath to by-pass module restrictions for testing.About the IllegalAccessError, the problem is that the test are run from the classpath so they can not access to com.github.forax.pro.api.impl. The merged module-info should more exports less restricted but that's not the right solution, as you said, the right solution is to run the ConsoleLauncher in another VM, so
The list of strings passed via
tester.overrideArguments
replace all other configuration arguments normally gathered by the plugin. See comments in https://github.com/forax/pro/commit/aed2faed92b0d53753f80017d35ae9a98864dd95This commit also fixes the ConsoleLauncher arguments to exclude the "." path from classpath scanning. The JShell sets "java.class.path" to "." which should not be scanned for test classes.