Test errors on Windows: UNWISE_CHARACTER in PATH
While trying to compile the current default branch (or the tag v0.6.4, currently master), I encounter a test error.
This is likely because the URI that is made in the test contains both forward and backward slashes. This happens because the code is using java.nio.Path to resolve the file in question, and the file separator for windows is "". In a unix system this isn't a problem, because the file separator is "/".
Replacing this line with
data.add(new String[]{ root.resolve("test1-in.ttl").toString(), root.resolve("test1-out.ttl").toString().replaceAll("\\\\","/") });
worked, but it isn't very pretty (or safe).
Steps to reproduce
- Clone tag v0.6.4 in a windows environment
- do a
mvn test
output from mvn --version
:
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.2
Java version: 11.0.5, vendor: Eclipse OpenJ9, runtime: C:\Program Files\AdoptOpenJDK\jdk-11.0.5.10-openj9
Default locale: no_NO, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Expected results
The tests to finish without test failures
Actual results
I get the following error:
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.233 s - in xyz.ottr.lutra.wottr.io.RDFFileReaderTest
[INFO] Running xyz.ottr.lutra.wottr.parser.v04.BaseInstanceExpansionTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.66 s <<< FAILURE! - in xyz.ottr.lutra.wottr.parser.v04.BaseInstanceExpansionTest
[ERROR] shouldBeIsomorphic[0: src\test\resources\baseinstances\test1-in.ttl, src\test\resources\baseinstances\test1-out.ttl](xyz.ottr.lutra.wottr.parser.v04.BaseInstanceExpansionTest) Time elapsed: 0.655 s <<< ERROR!
org.apache.jena.riot.RiotException: <file:///C:/work/git/lutra/lutra-wottr/src\test\resources\baseinstances\test1-out.ttl> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs. These characters are permitted in RDF URI References, XML system identifiers, and XML Schema anyURIs.
at xyz.ottr.lutra.wottr.parser.v04.BaseInstanceExpansionTest.shouldBeIsomorphic(BaseInstanceExpansionTest.java:62)