I´m reading a file from my resource folder in a unit test
I can see the file in the target/test-classes
But when I try to wrap the file into a fileInputStream this one throw the exception because cannot find the file
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("CV.pdf").getFile());
FileInputStream fis = new FileInputStream(file)
Output debuging:
classLoader.getResource("CV.pdf"):
file:/Users/Development/File%20-%20Test%20Java%20trial/Code/target/test-classes/CV.pdf
Maybe it could be because my folder has whitespace names?
The file is there for sure, I can seen it in that folder.
What I´m doing wrong here?.
Regards.