+ 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?

25th Jan 2018, 6:08 PM
Rajatendu Dey
Rajatendu Dey - avatar
1 Respuesta
+ 3
use the relative file path, instead of just the name
2nd Feb 2018, 6:29 AM
DeleteThisAccount