Tests failed if run from a directory with spaces in the path, because Class.getResource() returns a URL, and the path component of that URL, obtained with URL.getPath(), is not guaranteed to be a valid filename (e.g. spaces will be URL-encoded). However, converting the URL to an URI instance with URL.getURI() and passing that to the File constructor which accepts an URI instance will result in a valid filesystem path.
Summary:
Tests failed if run from a directory with spaces in the path, because
Class.getResource()
returns aURL
, and the path component of that URL, obtained withURL.getPath()
, is not guaranteed to be a valid filename (e.g. spaces will be URL-encoded). However, converting the URL to anURI
instance withURL.getURI()
and passing that to theFile
constructor which accepts anURI
instance will result in a valid filesystem path.Expected behavior:
Tests pass.