The pom.xml of my maven project looks as follows:
I was facing this same problem.
When you are trying to get the resource like this:
getClass().getResourceAsStream("test")
You are trying to find the resource relative to that package.
To get the resource from the src/main/resources
directory, you have to put a slash before the resource name.
getClass().getResourceAsStream("/test")