Description
The Windows CI build fails with an InvalidPath error in PureJavaTestEngineBodyTest.fileTypeResolvesExistingTestFixture. The test uses URL.getPath() to construct a Path, which returns a string starting with /D:/... on Windows. Path.of(String) rejects this because the : character at index 3 is illegal when preceded by a /.
Error
PureJavaTestEngineBodyTest.fileTypeResolvesExistingTestFixture:89 » InvalidPath
Illegal char <:> at index 3: /D:/a/api-tester-cli/api-tester-cli/target/test-classes/request-body-1.json
Root Cause
Line 89 of PureJavaTestEngineBodyTest.java:
// BROKEN — URL.getPath() returns "/D:/a/..." on Windows
Path suiteDir = Path.of(getClass().getResource("/request-body-1.json").getPath())
.getParent();
URL.getPath() returns the path component of the file: URL. On Unix this is fine (the leading / is the filesystem root). On Windows the URL is file:///D:/..., so getPath() returns /D:/... — a string that Path.of(String) cannot parse on Windows.
Every other test in the codebase already uses the correct .toURI() pattern; this was the only outlier.
Fix
Replace getPath() with toURI(), consistent with the rest of the test suite:
// FIXED — Path.of(URI) handles Windows drive letters correctly
Path suiteDir = Path.of(getClass().getResource("/request-body-1.json").toURI())
.getParent();
The method's throws clause is also widened from IOException to Exception since URL.toURI() throws URISyntaxException, which is not a subtype of IOException.
Affected file
src/test/java/io/github/snytkine/apitester/api_tester_cli/service/PureJavaTestEngineBodyTest.java, line 89
Observed on
Windows runner (windows-latest) in the GraalVM native binary release workflow.
Description
The Windows CI build fails with an
InvalidPatherror inPureJavaTestEngineBodyTest.fileTypeResolvesExistingTestFixture. The test usesURL.getPath()to construct aPath, which returns a string starting with/D:/...on Windows.Path.of(String)rejects this because the:character at index 3 is illegal when preceded by a/.Error
Root Cause
Line 89 of
PureJavaTestEngineBodyTest.java:URL.getPath()returns the path component of thefile:URL. On Unix this is fine (the leading/is the filesystem root). On Windows the URL isfile:///D:/..., sogetPath()returns/D:/...— a string thatPath.of(String)cannot parse on Windows.Every other test in the codebase already uses the correct
.toURI()pattern; this was the only outlier.Fix
Replace
getPath()withtoURI(), consistent with the rest of the test suite:The method's
throwsclause is also widened fromIOExceptiontoExceptionsinceURL.toURI()throwsURISyntaxException, which is not a subtype ofIOException.Affected file
src/test/java/io/github/snytkine/apitester/api_tester_cli/service/PureJavaTestEngineBodyTest.java, line 89Observed on
Windows runner (
windows-latest) in the GraalVM native binary release workflow.