I'm facing a very annoying issue while trying to run my project's junit tests inside a remote CI environment.
In my local machine with java 1.8.0_181 and maven 3.5.4 I don't have any problem.
I used to use the two ways bellow to get a test resource:
String expected = Utils.readStream(new FileInputStream(
"src/test/resources/testdata/fragment-subdir-absolute-path.txt"));
Using this I'm getting a file not found:
java.io.FileNotFoundException: fragment-subdir-absolute-path.txt (No such file or directory)
And with this:
String expected = Utils.readStream(new FileInputStream(getClass()
.getResource("/testdata/fragment-subdir-absolute-path.txt")
.getPath()));
In this case I'm getting a NPE:
[ERROR] testFragmentFragmentHost Time elapsed: 0.03 s <<< ERROR! java.lang.NullPointerException at org.osgi.service.indexer.impl.IndexerUnitTest.assertFragmentMatch(IndexerUnitTest.java:58) at org.osgi.service.indexer.impl.IndexerUnitTest.assertFragmentMatch(IndexerUnitTest.java:71) at org.osgi.service.indexer.impl.IndexerUnitTest.testFragmentFragmentHost(IndexerUnitTest.java:205)
But anyone is working inside of the remote CIs. The file is not being found.