Open SingingBush opened 6 years ago
for now I have a workaround that works when running the tests in Intellij as well as when the tests are run during the gradle build:
private Reader loadTestResource(final String resource) throws IOException {
final InputStream stream = ClassLoader.getSystemResourceAsStream(resource);
return stream != null ?
new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8"))) :
Files.newBufferedReader(Paths.get("src/test/resources/" + resource));
}
Yes, the test resources aren't being picked up by the modular setup. I tried modifying the test source set output directory for resources and it seems to be working:
sourceSets {
test {
output.resourcesDir = "build/classes/java/test"
}
}
I've got
exports my.package to junit;
in my module-info and most of my tests can now run while building but some tests rely on test data that I place insrc/test/resources
. when doing a build these tests fail as the resources are not found. I've tried various ways to get the resources such as: