0

In some unit tests initially we used such resource links for java.net.URL class

"https://<host name>/<project name>/pom.xml"

for loading test data. However, it doesn't work during offline development.

How it's possible to specify relative from test/java folder URL in file system?

I tried "file:///../pom.xml" but it brings to exception

java.io.FileNotFoundException: \..\pom.xml (The system cannot find the file specified)

If I specify "file://..\\pom.xml" I receive

Caused by: java.net.UnknownHostException: ..

Andriy Kryvtsun
  • 3,220
  • 3
  • 27
  • 41

1 Answers1

1

The answer is to use file: protocol specification without following slashes. As JUnit consider as a root the project folder in my case correct link to pom.xml is simple file:pom.xml

Andriy Kryvtsun
  • 3,220
  • 3
  • 27
  • 41