+ 1
How to get /src/main/resources from Junit?
I have a junit test needing to assert the format of a file which is located inside of the /src/main/resources. getClass().getClassLoader() .getResourceAsStream("myFile.txt") but this fails as it expects to have such a file inside of src/test/resources. Do I really have to copy the file inside of the src/test/resources?
1 Answer
+ 3
use the relative file path, instead of just the name