forked from gradle/gradle-java-modules
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test resources not available to unit tests #33
Comments
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:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:The text was updated successfully, but these errors were encountered: