Loading from the filesystem using relative paths during unit tests is problematic because different environments will set a different working directory for the test process. For example, Gradle uses the projects directory while IntelliJ uses the directory of the root project.
The only really safe way to solve this problem is to load via the classpath. Is this a possibility for your scenario?